Rule based aggregation of files and transactions in a switched file system

ABSTRACT

A switched file system, also termed a file switch, is logically positioned between client computers and file servers in a computer network. The file switch distributes user files among multiple file servers using aggregated file, transaction and directory mechanisms. The file switch distributes and aggregates the client data files in accordance with a predetermined set of aggregation rules. Each rule can be modified independently of the other rules. Different aggregation rules can be used for different types of files, thereby adapting the characteristics of the switched file system to the intended use and to the expected or historical access patterns for different data files.

RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.10/336,832, filed Jan. 2, 2003, now U.S. Pat. No. 7,512,673 which is acontinuation-in-part of U.S. patent application Ser. No. 10/043,413,filed Jan. 10, 2002, now U.S. Pat. No. 7,562,110 which claims thebenefit of U.S. Provisional Patent Application No. 60/261,153, filedJan. 11, 2001, all of which are incorporated by reference.

This application is furthermore related to the following applications,each of which is filed on the same date as this application and ishereby incorporated by reference in its entirety: TransactionAggregation in a Switched File System, Ser. No. 10/336,704; DirectoryAggregation for Files Distributed Over A Plurality of Servers in aSwitched File System, Ser. No. 10/336,833; Metadata Based File SwitchAnd Switched File, Ser. No. 10/336,835; Aggregated Lock Management forLocking Aggregated Files in a Switched File System, Ser. No. 10/336,834;and Aggregated Opportunistic Lock and Aggregated Implicit LockManagement for Locking Aggregated Files in a Switched File System, Ser.No. 10/336,784.

FIELD OF THE INVENTION

The present invention relates generally to the field of storagenetworks, and more specifically to file switching and switched filesystems.

DESCRIPTION OF THE RELATED ART

Since the birth of computer networking, access to storage has remainedamong the most important network applications. The reason is simple: thepurpose of networks was and is to share data and content, and most ofthe data worth sharing resides on some form of storage.

Despite the importance of storage applications in networks, theirusefulness has, until recently, been greatly limited by the insufficientbandwidth provided by networks. Even at 100 Megabits/second (Mbps) (themost common maximum speed in existing local area networks, also known asFast Ethernet), accessing data through a network is several times slowerthan reading it from a hard disk attached locally to a computer. Forthis reason, historically most of the data accessed by a networkedcomputer (workstation or application server—often referred to as a“client”) has resided on local storage and only data that has to beshared has resided on network servers.

The introduction of gigabit and multi-gigabit network technology,however, is changing the rules of the game. A single Gigabit Ethernet orFibreChannel connection is capable of transporting data at aggregaterates of up to 240 Megabytes/second (MB/s), which is much greater thanthe performance of most locally attached storage devices. This meansthat in new high speed networks, data can be accessed through thenetwork faster than from local storage. As a result, we have now reachedthe beginning of a fundamental trend in which the majority of usefuldata is being moved to the network.

Storage Networks

The ability to store terabytes of data on the network and make that dataaccessible to tens and hundreds of thousands of users is extremelyattractive. At the same time, creating storage and network systemscapable of adequately handling such amounts of information and usageloads is not a simple task. As a result, storage networking—thediscipline that deals with designing, building and managing suchsystems—is rapidly becoming recognized as a separate, specialized fieldof computer networking.

The key promise of storage networking is in delivering network systemsthat enable the sharing of huge amounts of information and content amonggeographically dispersed users. To deliver on this promise, the storagenetwork systems have to be extremely scalable while providing a highdegree of availability comparable to that of the public telephonesystem. In addition, any system of this scale has to be designed so thatit can be managed effectively.

Available Approaches to Scaling File Systems

The primary function of every file system is to enable shared access tostorage resources. In fact, file systems were originally created tofacilitate sharing of then-expensive storage between multipleapplications and multiple users. As a result, when exposed as a networkservice, file systems provide a complete and mature solution to theproblem of sharing data.

The flip side is that file systems are complex and veryprocessing-intensive, which increases substantially the performancerequirements to any computer that provides file services over a fastnetwork. To serve files to hundreds and thousands of userssimultaneously requires tremendous amounts of processing power, memoryand bus bandwidth.

FIG. 1 illustrates a typical application of presently available,commonly used network file systems. The system consists of a local areanetwork 104, which connects a large number of client workstations andapplication servers 102, connected to various file servers. The fileservers typically include standalone servers such as 105 and 106, aswell as file servers, such as 107 and 108, configured as a cluster 110with shared storage 118. The servers 107 and 108 are connected togetherthrough a high-speed, low-latency intra-cluster connection 112, and arealso connected to the shared storage 118 through a SAN (storage areanetwork), typically using optical (FibreChannel) interconnect 114 and116. In addition, clients and application servers 102 and file servers105 through 108 may be configured to be part of a distributed filesystem with the appropriate software services installed on all of thosemachines.

Single Box Solutions

Single box solutions provide a simple and straightforward approach tothe problem of increasing the performance of file servers.Traditionally, the fastest available computers were used to serve files;when even these became insufficient, specialized architectures werebuilt to extend the capabilities of the server. Where one processor wasnot enough, more processors were added; where the bandwidth of astandard bus was not sufficient, additional busses or evencustom-designed wider busses were introduced, and so on.

The result of this approach is that high-end file servers areessentially massively multiprocessing supercomputers, with all theassociated costs and complexity. Examples of single box solutions arethe EMC Celera/Symmetrix, SGI Origin, HP Superdome, Intel Paragon andIBM SP, the trademarks of which are hereby acknowledged. However,high-performance multiprocessing file servers quickly run into theperformance limits of their storage subsystems. The approach toresolving this bottleneck is to spread the load among multiple harddisks and data paths operating in parallel.

Single-box solutions are subject to several serious problems. First,because of the extremely high complexity and the need to develop customsilicon in order to satisfy performance requirements, single boxsolutions are very expensive. Second, their development cycles areexceedingly long, virtually guaranteeing that they will be “behind thecurve” in many important aspects, such as software technologies,protocols, etc., by the time they are generally commercially available.Since storage requirements effectively double every year or so, theseboxes often become obsolete long before the customers manage todepreciate their high cost.

Cluster File Systems

An alternative to scaling the server architecture within the box is toput together multiple servers accessing the same pool of storage over afast interconnect such as HIPPI or FibreChannel. The result is a“cluster” of computers that acts in many aspects similarly to amultiprocessing supercomputer but can be assembled from generallyavailable components.

Since all computers in a cluster access the same set of hard disks, thefile system software in each of them has to cooperate with the othermembers of the cluster in coordinating the access and allocation of thestorage space. The simplest way to approach this problem is to sectionthe storage pool and divide it among the different computers in thecluster; this approach is implemented in Windows clustering described in“Windows Clustering Technologies—An Overview”, November 2000, MicrosoftCorp. The main challenge in the above-mentioned file system comes fromthe need to frequently synchronize and coordinate access to the storageamong all members of the cluster. This requires a centralized lockmanager and/or a file manager that controls the allocation of disk spaceto different files and controls access to those files. These componentsquickly become a major bottleneck that prevents the scaling of clusterfile systems beyond about sixteen nodes.

The reliance on centralized resource coordination is the primary weakpoint of cluster file systems that limits severely their scalability.Solutions that partially relieve this problem introduce other problems,including custom functionality in storage subsystems and specializedclient-side software. If any of these approaches is commercialized, therequirement for using proprietary storage subsystems will havesubstantial negative effect on both adoption and price, while the needto rely on proprietary client-side software that has to be installed inevery client accessing the system make the system fragile, prone tosecurity breaches and hard to deploy and support.

Distributed File Systems

Both single box solutions and cluster file systems are tightly coupledsystems that exhibit serious scalability limitations. Creatingdistributed file systems is an approach attempting to combine hundredsof file servers in a unified system that can be accessed and managed asa single file system. Examples of distributed file systems are theAndrew File System, and its derivatives AFS and Coda, Tricord, as wellas the Microsoft Distributed File System DFS.

Distributed file systems are loosely coupled collections of file serversthat can be located in diverse geographical locations. They provide aunified view of the file namespace, allowing clients to access fileswithout regard to where in the system those files reside. In addition,the system administrator can move files from one server to another in atransparent fashion and replicate files across multiple servers forincreased availability in case of partial system failure.

Distributed file systems exhibit excellent scalability in terms ofstorage capacity. It is easy to add new servers to an existing systemwithout bringing it off-line. In addition, distributed file systems makeit possible to connect storage residing in different geographicallocations into a single cohesive system.

The main problem with available distributed file systems is that they donot scale in performance nearly as well as they scale in storagecapacity. No matter how large the number of servers in the system, eachindividual file resides on exactly one server. Thus, the performance thedistributed file system can deliver to a single client (workstation orapplication server) is limited by the performance of the utilizedindividual file servers, which, considering the large number of serversinvolved, is not likely to be a very high performance machine.

Another problem that has great impact in commercial environments is thefact that most distributed file systems require specialized client-sidesoftware that has to be installed and configured properly on each andevery client that is to access the file system. This tends to createmassive versioning and support problems.

Moreover, distributed file systems are very prone to “hotspotting”.Hotspotting occurs when the demand for an individual file or a small setof files residing on a single server increases dramatically over shortperiod of time, resulting in severe degradation of performanceexperienced by a large number of users.

Yet another problem with distributed file systems is in their lowmanageability. Although most aspects of the distributed file systems canbe managed while the system is on-line, the heterogeneous anddistributed nature of these systems effectively precludes any seriousautomation of the management tasks. As a result, managing distributedfile systems requires large amount of highly qualified labor.

SUMMARY

Although many approaches to scaling network file systems have been takenover the last fifteen years, none has succeeded in delivering on thehigh performance, high scalability and simple management promise ofstorage networking. Analysis of the systems described above shows thatall of their limitations can be traced to a small set of fundamentalflaws, namely, all available systems suffer from at least one of thefollowing problems:

1. One file, one server. The inability to utilize multiple file serversin handling requests for a single file limits severely the throughputavailable to any single client and does not allow the system to balancethe load across all available processing resources.2. Centralized arbitration and metadata management. The need toarbitrate access to storage and the shared data structures used tomanage it creates a bottleneck that severely limits the scalability ofthe system.3. Proprietary client-side software. The need to buy, install, configureand support a non-trivial piece of software across all client machinesrunning multiple different operating systems creates serious barrier foradoption.Conclusions

With the mass adoption of gigabit and multi-gigabit networkinfrastructure, storage networking is rapidly becoming key to deliveringand managing content on the network. To achieve this, storage networkshave to facilitate sharing of data among thousands (or even largernumbers) of users, be able to scale in storage capacity, performance andaccess bandwidth extremely well, provide a very high degree ofavailability, and be easy to manage. Increasingly, new applications,such as e-mail, streaming video content, document repositories, andother soft-structured data, require these characteristics to be achievedby a network service that provides access to files.

The existing approaches to scaling network file systems are successfulin solving one or another aspect of these requirements. However, thereis no currently available system that can deliver all characteristicsneeded for storage networking to achieve its promise.

SUMMARY OF THE INVENTION

A switched file system, also termed a file switch, is logicallypositioned between client computers and file servers in a computernetwork. The file switch distributes user files among multiple fileservers using aggregated file, transaction and directory mechanisms. Ahierarchical directory structure of data files is created on the fileservers, with each data file that stores a portion of a user file havinga global unique identifier that determines at least a portion of thedata file's file path with the hierarchical directory structure. Ahierarchical directory structure on the file servers is also used tostore metadata files, which store metadata for each user file toindicate where the data files for the user file are stored. The fileswitch automatically and randomly spreads the data files and metadatafiles over a large number of distinct directories on multiple fileservers, preventing large number of data files from being stored in asingle directory on a single file server. Hence, the file switchbalances the load and improves the performance of the switched filesystem. In response to a directory enumeration request from a clientcomputer, one or more directories of metadata files on one or more ofthe file servers is enumerated, instead of enumerating the data filethat store the user file portions.

The file switch distributes and aggregates the client data files inaccordance with a predetermined set of aggregation rules. Each rule canbe modified independently of the other rules. Different aggregationrules can be used for different types of files, thereby adapting thecharacteristics of the switched file system to the intended use and tothe expected or historical access patterns for different data files.Also, multiple file switches communicate with the same set of fileservers without interacting with each other, thereby making it possibleto scale access bandwidth of the switched file system by adding fileswitches whenever needed.

BRIEF DESCRIPTION OF THE DRAWINGS

The aforementioned features and advantages of the invention as well asadditional features and advantages thereof will be more clearlyunderstood hereinafter as a result of a detailed description of apreferred embodiment of the invention when taken in conjunction with thefollowing drawings in which:

FIG. 1 illustrates a prior art storage network including a distributedfile system and a clustered file system;

FIG. 2 illustrates a file switch in a computer network;

FIG. 3 illustrates a switched file system;

FIG. 4 illustrates transaction aggregation by a file switch;

FIG. 5 illustrates the client's view of a switched file system;

FIG. 6 illustrates the hardware architecture and memory structure of afile switch;

FIG. 7 illustrates the data plane of a file switch;

FIG. 8 illustrates an exemplary metafile;

FIG. 9 illustrates namespace aggregation by a file switch;

FIG. 10 illustrates data aggregation through mirroring;

FIG. 11 illustrates data aggregation through striping;

FIG. 12 illustrates data aggregation through spillover;

FIG. 13 illustrates the syntax of data aggregation rules;

FIG. 14 illustrates a method for creating directory structure for ametafile;

FIG. 15 illustrates the storage of metafile and user file;

FIG. 16 illustrates a method for creating directory structure for a datastream file;

FIG. 17 illustrates a method for creating directory path with globalunique identifier;

FIG. 18 illustrates a method for balancing load at the file switchlevel;

FIG. 19 illustrates a method for transaction aggregation;

FIG. 20 illustrates a method for accessing an aggregated user filethrough the metafile;

FIG. 21 illustrates an exemplary concurrency problem;

FIG. 22 illustrates a method for implementing an implicit lockingmechanism;

FIG. 23 a illustrates a method for handling an opportunity lockingrequest;

FIG. 23 b illustrates a method for handling an opportunity locking breaknotification;

FIG. 23 c illustrates a method for mapping level of exclusivity ofcaching to the oplock exclusivity level granted;

FIG. 24 illustrates a method for handling a semaphore locking mechanism;

FIG. 25 illustrates a method for enumerating a directory;

FIG. 26 illustrates a method for implementing a redundant metavolumecontroller.

DETAILED DESCRIPTION

The following description is provided to enable any person skilled inthe art to which the invention pertains to make and use the inventionand sets forth the best modes presently contemplated by the inventor forcarrying out the invention. Various modifications, however, will remainreadily apparent to those skilled in the art, since the basic principlesof the present invention have been defined herein specifically toprovide a file switch, a switched file system and their mechanisms ofoperation. Any and all such modifications, equivalents and alternativesare intended to fall within the spirit and scope of the presentlyclaimed invention.

DEFINITIONS

Aggregator. An “aggregator” is a file switch that performs the functionof directory, data or namespace aggregation of a client data file over afile array.

Data Stream. A “data stream” is a segment of a stripe-mirror instance ofa user file. If a data file has no spillover, the first data stream isthe stripe-mirror instance of the data file. But if a data file hasspillovers, the stripe-mirror instance consists of multiple datastreams, each data stream having metadata containing a pointer pointingto the next data stream. The metadata file for a user file contains anarray of pointers pointing to a descriptor of each stripe-mirrorinstance; and the descriptor of each stripe-mirror instance in turncontains a pointer pointing to the first element of an array of datastreams.

File Array. A “file array” consists of a subset of servers of a NASarray that are used to store a particular data file.

File Switch. A “file switch” performs file aggregation, transactionaggregation and directory aggregation functions, and is logicallypositioned between a client and a set of file servers. To clientdevices, the file switch appears to be a file server having enormousstorage capabilities and high throughput. To the file servers, the fileswitch appears to be a client. The file switch directs the storage ofindividual user files over multiple file servers, using striping toimprove throughput and using mirroring to improve fault tolerance aswell as throughput. The aggregation functions of the file switch aredone in a manner that is transparent to client devices.

Switched File System. A “switched file system” is defined as a networkincluding one or more file switches and one or more file servers. Theswitched file system is a file system since it exposes files as a methodfor sharing disk storage. The switched file system is a network filesystem, since it provides network file system services through a networkfile protocol—the file switches act as network file servers and thegroup of file switches may appear to the client computers as a singlefile server.

Data File. In the present invention, a file has two distinct sections,namely a “metadata file” and a “data file”. The “data file” is theactual data that is read and written by the clients of a file switch. Afile is the main component of a file system. A file is a collection ofinformation that is used by a computer. There are many different typesof files that are used for many different purposes, mostly for storingvast amounts of data (i.e., database files, music files, MPEGs, videos).There are also types of files that contain applications and programsused by computer operators as well as specific file formats used bydifferent applications. Files range in size from a few bytes to manygigabytes and may contain any type of data. Formally, a file is a calleda stream of bytes (or a data stream) residing on a file system. A fileis always referred to by its name within a file system.

Metadata File. A “metadata file”, also referred as the “metafile”, is afile that contains the metadata, or at least a portion of the metadata,for a specific file. The properties and state information about aspecific file is called metadata. In the present invention, ordinaryclients cannot read or write the content of the metadata files, butstill have access to ordinary directory information. In fact, theexistence of the metadata files is transparent to the clients, who neednot have any knowledge of the metadata files.

Mirror. A “mirror” is a copy of a file. When a file is configured tohave two mirrors, that means there are two copies of the file.

Network Attached Storage Array. A “Network Attached Storage (NAS) array”is a group of storage servers that are connected to each other via acomputer network. A file server or storage server is a network serverthat provides file storage services to client computers. The servicesprovided by the file servers typically includes a full set of services(such as file creation, file deletion, file access control (lockmanagement services), etc.) provided using a predefined industrystandard network file protocol, such as NFS, CIFS or the like.

Oplock. An oplock, also called an “opportunistic lock” is a mechanismfor allowing the data in a file to be cached, typically by the user (orclient) of the file. Unlike a regular lock on a file, an oplock onbehalf of a first client is automatically broken whenever a secondclient attempts to access the file in a manner inconsistent with theoplock obtained by the first client. Thus, an oplock does not actuallyprovide exclusive access to a file; rather it provides a mechanism fordetecting when access to a file changes from exclusive to shared, andfor writing cached data back to the file (if necessary) before enablingshared access to the file.

Spillover. A “spillover” file is a data file (also called a data streamfile) that is created when the data file being used to store a stripeoverflows the available storage on a first file server. In thissituation, a spillover file is created on a second file server to storethe remainder of the stripe. In the unlikely case that a spillover fileoverflows the available storage of the second file server, yet anotherspillover file is created on a third file server to store the remainderof the stripe. Thus, the content of a stripe may be stored in a seriesof data files, and the second through the last of these data files arecalled spillover files.

Strip. A “strip” is a portion or a fragment of the data in a user file,and typically has a specified maximum size, such as 32 Kbytes, or even32 Mbytes. Each strip is contained within a stripe, which is a data filecontaining one or more strips of the user file. When the amount of datato be stored in a strip exceeds the strip's maximum size, an additionalstrip is created. The new strip is typically stored in a differentstripe than the preceding stripe, unless the user file is configured (bya corresponding aggregation rule) not to be striped.

Stripe. A “stripe” is a portion of a user file. In some cases an entirefile will be contained in a single stripe. Each stripe is (or is storedin) a separate data file, and is stored separately from the otherstripes of a data file. As described elsewhere in this document, if thedata file (also called a “data stream file”) for a stripe overflows theavailable storage on a file server, a “spillover” file is created tostore the remainder of the stripe. Thus, a stripe is a logical entity,comprising a specific portion of a user file, that is distinct from thedata file (also called a data stream file) or data files that are usedto store the stripe.

Stripe-Mirror Instance. A “stripe-mirror instance” is an instance (i.e.,a copy) of a data file that contains a portion of a user file on aparticular file server. There is one distinct stripe-mirror instance foreach stripe-mirror combination of the user file. For example, if a userfile has ten stripes and two mirrors, there will be twenty distinctstripe-mirror instances for that file. For files that are not striped,each stripe-mirror instance contains a complete copy of the user file.

Subset. A subset is a portion of thing, and may include all of thething. Thus a subset of a file may include a portion of the file that isless than the entire file, or is may include the entire file.

User File. A “user file” is the file or file object that a clientcomputer works with, and is also herein called the “aggregated file.” Auser file may be divided into portions and stored in multiple data filesby the switched file system of the present invention.

File Switch and Switched File System

FIG. 2 illustrates an inventive network configuration including a fileswitch 200. In this configuration, the file switch 200 is implementedwith two different network interfaces: one for connecting to the clientnetwork 211 through connection 209, and the other for connecting to afile server network through connections 210 and other similarconnections as shown. For simplicity, the file switch 200 is shown inthis Figure as being directly connected to each of the file servers 201through 207. In practice, one or more commonly available layer 2switches are preferably used to implement these connections.

Since most popular network file protocols are based on the IP standard,the file switch preferably supports TCP/IP network protocols, as well asother protocols of the IP stack (e.g., ARP), as appropriate. The fileswitch preferably supports multiple industry standard network fileprotocols, such as NFS and CIFS.

Clients, such as workstations and application servers 212 request fileservices by communicating to the file switch 200 using the NFS or CIFSprotocols. File switch 200 preferably implements the server side of theappropriate network file protocol on the connection 209. The switchfurther interacts with the file servers 201 through 207 by implementingthe client side of preferably the same network file protoco. Thepresence of file switch 200 is thereby preferably transparent to boththe clients and the servers.

Additionally, the file switch may implement other IP protocols, such asDHCP, DNS or WINS, either as a client or as a server for purpose ofconfiguring file servers 201 through 207, self-configuration of the fileswitch, and others that will be described herein.

The file switch 200 implements industry standard protocols both on theclient side (via connection 209) and on the server side (via connections210). This implementation allows the file switch 200 to function in anenvironment where the file servers 201 through 207 are standard,commercially available file servers or NAS appliances, and clients 212are standard commercially available computers. In this manner, thebenefits of the file switch can be utilized without requiring anyproprietary software to be installed and maintained on any other networknode.

The primary functionality of the file switch can be divided into threebroad categories: 1) transaction handling; 2) file system aggregation;and 3) switch aggregation. Transaction handling includes transactionswitching and transaction aggregation. File system aggregation includesaggregating file system objects and data file. Switch aggregationincludes various mechanisms for combining multiple file switchestogether, which includes load balancing, configuration sharing,fail-over and management aggregation. The functionality of the fileswitch may be implemented in software, in hardware or any combination ofsoftware and hardware, as appropriate.

A switched file system is a distributed file system as it aggregates thenamespaces of multiple file servers. It is also a parallel file system,as it can utilize multiple file servers in parallel to satisfy therequest of a single network file client. Therefore, the switched filesystem is a new type of distributed, parallel network file system.

FIG. 3 illustrates a switched file system, including its configurationsand applications. The exemplary switched file system consists of thefollowing elements. A set of file switches 308 are aggregated in a group309, and are connected to two arrays of file servers 310 and 311, whichare called NAS arrays. The file switches 308 are also connected to alegacy file server 313, typically containing archive and other pre-fileswitch content, which is aggregated only by namespace (i.e., the fileswitches 308 do not perform file aggregation for the files stored by thelegacy file server 313). In addition, the file switch group 309aggregates the namespace of another switched file system provided by thefile switch group 314 connected to NAS array 315 and connected to thegroup 309 through a layer 2 switch 312.

The services of the group 309 are provided to a network 305 thatincludes clients 306, a management workstation 307 and a connection to ametro-area network 304. The metro-area network 304 provides the remoteLAN 300 and its clients 301 with file services made available by group309. In order to improve the access to these services, the remote LAN300 also includes a file switch 302, which acts as a gateway to thegroup 309 and caches files locally to the NAS array 303.

Topologies

The switched file system provides many combinations of file systemaggregation and supports different topologies.

One of the available topologies is virtualization. In virtualization,the switched file system aggregates the namespace exposed by a singlefile server (e.g., legacy file server 313) without further aggregatingits files on other servers. One of the mechanisms available for this isthe namespace aggregation technique described herein. The virtualizationallows pre-existing file servers to be made available to clients of theswitched file system and included in its logical namespace. Thisfunctionality facilitates the adoption of the switched file system andprovides an incremental approach to adoption.

Another available topology is NAS array. The switched file system canhave a set of file servers (e.g., the servers in array 310), preferablywith similar capacity and performance characteristics, designated as aNAS array. The file switches participating in the switched file systemdistribute files across the file servers in the NAS array, by using thedirectory, and data aggregation mechanisms described herein. NAS arraysprovide high performance and high availability. Multiple NAS arrays canbe configured in the same switched file system, and their namespaces canbe aggregated with virtualized file servers to present a unifiednamespace.

Yet another available topology is cascading. In a cascadedconfiguration, one or more switched file systems can be connected withinanother switched file system, effectively playing the role of a fileserver in that other switched file system. In our example, the fileswitches 314 and the NAS array 315 comprise a small switched filesystem, which is aggregated in the namespace of the switched file systempresented by the group 309. Since the file switches 314 appear as a fileserver to the file switches 309, the latter can aggregate the namespaceprovided by the former the same way as the virtualized server 313. Oneskilled in the art will easily recognize that multiple instances of theswitched file system comprising the file switches 314 and the NAS array315 may exist, and may be aggregated by the switches in the group 309 inany and all ways in which the latter may aggregate regular file servers,including data aggregation, directory aggregation, and so on.

Another topology is the gateway topology. A file switch 302, preferablyhaving its own NAS array 303, acts as a gateway to clients locallyconnected to it, and provides access to the file services made availableby the file switch group 309. An advantage of this topology is that theconnection between group 309 and file switch 302, such as the MAN 304,may have lower bandwidth than the local networks 305. The gatewaytopology allows the gateway file switch 302 to cache locally on the NASarray 303 files normally residing on the file system exposed by thegroup 309. Since the file switch 302 appears as just another client tothe file switch group 309, all locking and other client semantics areavailable to the file switch 302 to provide caching.

Basics of Transaction Aggregation by a File Switch

The typical operation of the file switch involves receiving fileprotocol requests, such as login, tree connect/mount, file open, fileread/write, etc., from clients and forwarding, or switching theserequests to one or more of the file servers.

FIG. 4 illustrates a preferred process by which a file switch candelegate a single transaction received from a client to more than onefile server and therefore aggregate the behavior of those servers inhandling the transaction. The behavior of the file switch is presentedto the original client as the behavior of a single file server.

Consider the case in which a file switch 400 stripes the data of a fileamong file server 401, connected to the file switch through connection403, and file server 402, connected to the file switch throughconnection 404, in order to deliver higher aggregate performance toclients by making these two file servers handle requests in parallel.

In this example, a client 406 is connected through a computer network407 to the file switch 400 through connection 408. The client 406 hasestablished preferably a TCP connection to the file switch 400, andbelieves the file switch 400 to be a file server. The client 406,therefore, initiates a file write transaction of a file named myFile.docby issuing a write request message to the file switch 400. Afterreceiving the write request message, the file switch is in a position todecide how to handle the transaction.

In this example, the switch handles the transaction by splitting it intotwo transactions targeted to two separate file servers 401 and 402. Uponexamining the write request, the file switch updates its state (asdiscussed in more detail below) in a manner sufficient to accomplish thegoal, and forwards the write request to the file servers 401 and 402 viathe connections 403 and 404, respectively. The two file servers 401 and402 receive separate file write requests, each for its appropriate fileand each with the appropriate portion of the data to be written. Thefile servers execute the requested write operations in parallel andsubmit their respective responses to the file switch, which they believeto be the originator of the write requests. It should be noted that thisprocess does not require in any way that servers 401 and 402 interactwith one another or even be aware of the other's existence.

Upon receipt of responses from file servers 401 and 402, respectively,the file switch 400 knows the results of both write requests submittedby it and is, therefore, in a position to form a response to theoriginal client containing the aggregate result of the transaction. Theswitch achieves this by sending an acknowledgement to the originalclient. The client receives the response and sends the file myFile.docto the file switch. The file switch in turn sends the file myFile.doc tothe appropriate directory in servers 401 and 402. The transaction is nowcomplete.

The mechanism described above enables two innovative results. First, thefile switch can aggregate a set of file system entities, such as filesor directories that reside on different file servers and present thisset to the clients as a single cohesive entity, thereby forming thefoundation for aggregating complete file systems.

Second, this mechanism allows the switch to split or replicateindividual read and write network file transactions among multiple fileservers, which execute the requested operations in parallel. In thismanner, the present invention sets the foundation for forming theequivalent of a parallel file system on a network including fileswitches and file servers. The file switch has the ability to deliveraggregate performance to each client that is many times higher than theperformance of the individual file servers available to it.

Client's View of the Switched File System

From the standpoint of a network file client, such as 406, the switchedfile system appears as a single file server with multiple networkinterfaces. FIG. 5 illustrates the similarity between a switched filesystem and a single file server. Network clients connect to the switchedfile system 500 through the interfaces 501 as they would connect to thesingle file server 502 though its interfaces 503.

The switched file system 500 preferably provides a single namespace. Itallows network file clients to use standard client software using widelystandardized network file protocols for accessing file servers, such asthe CIFS and NFS protocols. The ability of standard file client softwareto access the switched file system simplifies adoption and also allowschanges to the switched file system mechanisms and topologies to beperformed transparently to all clients.

Administrator's View of the Switched File System

An administrator's view of the switched file system 500 is to a degreesimilar to the client's view. For most operations, the administratorviews the switched file system 500 as if it were a single,high-capacity, high-performance, and highly available file server 502.For the purposes of management and reconfiguration it preferably appearsas a single file server. The file switches preferably support the samefile server management protocols (such as MSRAP) as single CIFS or NFSfile servers do. The switched file system can be configured to exposeshares/mount points in the aggregated namespace to their clients.

Administrators can add individual file servers (using the virtualizationtopology) and new NAS arrays to the switched file system 500, and canalso add or remove file servers to or from existing NAS arrays in theswitched file system. In the event the administrator adds one or morefile servers to an existing NAS array, the file switch can discover thenewly added servers (or automatically have access to the added servers).And preferably on administrator's request, the file switchesredistribute the files and their data across all file servers, includingthe newly added ones, thus extending both the capacity and theperformance of the file system. In case the administrator wishes toremove one or more file servers from a NAS array, the administrator canrequest that a file switch free up specified servers (by redistributingthe files to the file servers that remain in the NAS array). Uponcompletion of that process, the file switches notifies the administratorthat the selected file servers are free and can be removed without dataloss.

The switched file system 500 provides high availability by distributingthe work among many file switches and file servers. Failure of a fileserver or a file switch typically does not cause loss of data or loss ofaccess. The administrator can be notified of the failure and replace orrepair the failed component.

The switched file system preferably tracks access patterns and canreport statistical information to the administrator. Based on thisinformation, the administrator can tune the performance and storagecapacity utilization of the switched file system 500, for instance byadding or reconfiguring NAS arrays, file switches and by changingaggregation rules (discussed below) on the file switches.

Scaling in Switched File System

The switched file system scales capacity and performance by adding morefile servers to a NAS array and distributing files across all fileservers. It scales access bandwidth by adding more file switches to aconnected group and accesses the same set of file servers, providing awider access path (multiple network connections). Unlike prior artsolutions, the switched file system scales independently in multipledirections (or dimensions) without inherent limitations.

The switched file system also scales in geographical distribution byadding cascaded file switches (or switched file system) and gateway fileswitches.

Metadata Based Switched File System

Hardware Architecture

In a preferred embodiment, each file switch 400 (FIG. 4) of the metadatabased switched file system is implemented using a computer systemschematically shown in FIG. 6. The computer system (i.e., the fileswitch) one or more processing units (CPU's) 600, at least one networkor other communications interface 604, a switch 603 or bus interface forconnecting the network interfaces to the system busses 601, a memorydevice 608, and one or more communication busses 601 for interconnectingthese components. The file switch may optionally have a user interface602, although in some embodiments the file switch is managed using aworkstation connected to the file switch via one of the networkinterfaces 604. In alternate embodiments, much of the functionality ofthe file switch may be implemented in one or more application specificintegrated circuits (ASIC's), thereby either eliminating the need for aCPU, or reducing the role of the CPU in the handling file accessrequests by client computers.

The memory 608 may include high speed random access memory and may alsoinclude non-volatile memory, such as one or more magnetic disk storagedevices. The memory 608 may include mass storage that is remotelylocated from the central processing unit(s) 600. The memory 608preferably stores:

-   -   an operating system 610 that includes procedures for handling        various basic system services and for performing hardware        dependent tasks;    -   a network communication module 611 that is used for controlling        the communication between the system and various clients 606 and        file servers via the network interface(s) 604 and one or more        communication networks, such as the Internet, other wide are        networks, local area networks, metropolitan area networks, and        so on;    -   a file switch module 612, for implementing many of the main        aspects of the present invention;    -   state information 620, including transaction state 621, open        file state 622 and locking state 623; and    -   cached information 624, including cached (and aggregated) data        file 626 and corresponding metadata files 625.

The file switch module 612, the state information 620 and the cachedinformation 624 may include executable procedures, sub-modules, tablesand other data structures.

In other embodiments, additional or different modules and datastructures may be used, and some of the modules and/or data structureslisted above may not be used.

Software Architecture

Layering Model

FIG. 6 also illustrates the preferred software architecture for ametadata based switched file system. The software architecture of theswitched file system is preferably divided in three planes: the coreservices plane 613, the control plane 614, and the data plane 615.

The core services layer 613 provides basic services to all components inthe remaining layers. These services include services provided by theoperating system (memory management, component model, threading), aswell as services developed specifically for the file switch as anunattended and always-on device (configuration database, event manager,etc.). These services are general, low-level computer services, and areminimally dependent on the particular functions of a file switch.

The control plane layer 614 is responsible for maintaining the operationof the data plane 615. It sets up the configuration of the data plane,controls the life cycle of the file switch, such as start, stop, andrestart, and implements various management protocols. In addition, itincludes additional services that provide features like clustering offile switches, load balancing, failover, backup, file system check andrepair, and automated management. These functions don't participatedirectly in serving client-originated file requests, but are essentialfor the existence and continued operation of the file switch. Thesefunctions may also include value-adding services, such as data migrationand accounting.

The data plane layer 615 is responsible for file switching andaggregation. It provides all protocol layers through which file requestspass as well as the switching logic that distributes these requests tothe file servers and aggregates the responses. All requests to accessfiles and user file directories go through the data plane 615 and areserved by it.

The Data Plane

In the preferred embodiment illustrated in FIG. 7, the data planeconsists of the following key components.

The TCP/IP Transport 708 includes the NetBT (NETBIOS over TCP/IP)sub-layer used by the Server Service (SRV) 718 and Parallel Redirector706 (RDR) components. This includes the entire transport layer from theTCP or NetBT session layer down to the physical Ethernet interface. Forfast operation and minimum load on the CPU, the file switch uses ahardware-implemented or hardware-assisted extension of the TCP/IPimplementation. However, the use of hardware-assisted TCP is notrequired for the file switch to operate because the components thatinterface with TCP, such as SRV 718 and RDR 706, use the standardtransport protocol interface provided by the TCP/IP transport.

The Server Service 718 (SRV) is the CIFS file server service. Itinterprets the clients' requests for operations on files sent as CIFScommands and translates them to NT/WDM file I/O requests (IRPs). SRV 718handles the entire process of authenticating clients. Other fileprotocol servers can be used instead of or along with the CIFS fileserver (e.g., NFS).

The Virtual File System 702 (VFS) is a file system driver, anInstallable File System, in WDM terms. VFS 702 provides the common namespace of the File Switch, which makes multiple NAS Arrays combined intoaggregated file systems along with legacy single-server NAS file systemsappear as a single file system to the client. In addition, VFS serves asa “security context gateway”, working in the context of the connectedclient on its front side and providing the mandated access controlchecks, while operating in the “local system” context when accessing theconstituent file systems that make up the “virtual” namespace. Finally,VFS implements the local caching of open files to provide low latency tothe clients and optimize access to the constituent server file systemsby consolidating small I/O requests (“lazy write”, “read ahead”).

The Aggregated File System 704 (AFS) is a file system driver. Itimplements the “Switched File System” aggregation mechanisms. Itpresents an array of file servers as a single file system bydistributing the metafiles and the data files stored among the fileservers. It also performs the function of aggregating data files andload balancing accesses between clients and the array of file servers.AFS further provides advanced NTFS-style features including Unicodenames, extended attributes and security descriptors, even if the filesystems that it aggregates do not have this support.

The Parallel Redirector 706 (RDR) is a file system driver. It is similarto the Windows Workstation service, which exposes a file I/O interfaceand converts it to network file I/O requests sent to a remote server. Ituses multiple concurrent connections to the same network server in orderto alleviate the inability of some CIFS implementations to handlemultiple pending client read and write requests on the same networkconnection. In addition, the RDR is used to access the virtualized“legacy” servers and to perform operations on aggregated data files ofthe file system.

The data plane also includes a front-side network interface 710 and aback-side network interface 712. A front-side and a back-side TCP/IPprotocol stack reside within the TCP/IP transport 708.

Various other services, such as DHCP, DNS, load-balancing, command-lineand/or web-based management, SNMP, etc., may be included in or added tothe architecture described above.

The implementation of the architecture described above can be arrangedin many possible ways. For example, the network interfaces may beimplemented in hardware, while the rest of the data plane and the tworemaining planes are fully implemented in software. Alternatively,additional portions of the data plane may be implemented in hardware(e.g., by using Field-Programmable Gate Arrays, Application-SpecificIntegrated Circuits, switch fabrics, network processors, etc.), whilethe control plane 614 may be implemented in software. In addition, thecontrol plane 614 may be further implemented or accelerated in hardware.Moreover, it may be advantageous to implement portions of a certainplane (e.g., the data plane or the control plane) by providingaccelerated functions in hardware while maintaining the rest of theplane's functionality (such as setup, initialization and other slowfunctions) in software. In other embodiment, the Aggregated File System704 is provided, but the Virtual File System 702 is not provided. In yetanother embodiment one or more of the modules of the file switch areimplemented on the file servers of a NAS array.

One skilled in the art will easily recognize that various otherarchitectures for implementing a file switch are possible. In addition,while most of the particular choices made in implementing the fileswitch (such as those described above) are preferably driven by theperformance and cost targets of the file switch, all variousimplementations fall within the spirit of the present invention.

Operation of the Data Plane

In normal operation, the components in the data plane interact with eachother and with the Ethernet interfaces of the File Switch. The followingsteps illustrate the interactions between the components for anexemplary client session.

Exemplary Client Session

1. Client connects to the file switch via the network interface 710.

-   -   The TCP connection request is forwarded to SRV 718 via the        TCP/IP transport.        2. Client logs in and attaches to a shared mount point exposed        by the switch.    -   The client's request arrives as a series of CIFS commands. SRV        718 performs authentication of these requests without involving        any other data plane components.        3. Client opens a file.    -   As the shared mount point exposed by SRV 718 is associated with        the file system owned by VFS 702, SRV 718 translates the request        to a file system operation on VFS 702.    -   Next, VFS 702 consults a virtualization table stored in the        configuration database and finds the translated path for the        file. This path may point to a file on a “legacy” file system        handled by RDR 706 or to a file on an aggregated file system        handled by AFS 704.    -   Next, VFS 702 retrieves the security descriptor for the file and        performs a security check to verify the client's right to open        the file. If the check passes, the open request is forwarded to        AFS 704 or RDR 706 using the translated file path. Upon        successful completion of the “open”, VFS 702 will request an        opportunistic lock (op-lock) on the file in order to enable        local caching of the file.    -   If the file is on a “legacy” file system, RDR 706 completes the        open operation through its CIFS connection to the NAS sever.

If the file is on an aggregated file system, the “open” request ishandled by AFS 704. Then, AFS 704 begins processing of the “open”request by issuing an “open” request to all mirror copies of themetadata file that represents the client's aggregated data files throughRDR 706. If at least one mirror copy is opened successfully, AFS 704completes the client's open request and starts calling RDR 706 to openthe data files that hold the client's data.

-   -   For each of the data files, RDR 706 picks one of its “trunked”        connections to the corresponding NAS server to use for that file        and sends a CIFS open request to that connection. Following an        analogy from the telecom world, the use of multiple connections        to the same target in order to increase throughput is referred        to in this specification as a “trunked” connection.        4. Client reads metadata (e.g., directory information).    -   A client request to read file attributes, file size and similar        requests not related to data read/write are forwarded to SRV 718        and are converted to file system operations on the metadata file        corresponding to the specified user file. All of these requests        go through the same path as follows:        -   the VFS 702 forwards the requests directly to the same file            system on which the file was originally opened.        -   if file is found on the AFS 704, the AFS 704 forwards the            requests to RDR 706 as an operation on one of the mirror            copies of the metadata file or to all mirror copies, if the            operation involves a modification of the metadata file.        -   the RDR 706 converts the requests to CIFS requests and sends            them to the NAS server.            5. Client requests a data operation.    -   Client's data requests are converted by SRV 718 into “read”,        “write” and “lock control” file I/O requests sent to VFS 702.        Data operations on aggregated files are forwarded from VFS 702        to AFS 704. AFS 704 consults its aggregation table, compiled        from data in the configuration database, computes how to        distribute the requests among the data files that hold the        client's data and forwards those requests to the data files open        on RDR 706.        6. Client disconnects.    -   When the client disconnects, SRV 718 closes any files that were        left open, thus providing proper closing of files on the        servers, even if the client does not close its file before        disconnecting.

One skilled in the relevant art will easily recognize that variousmodifications of this architecture can work well for the inventive fileswitch while preserving the spirit of the present invention. Forexample, more network interfaces 710 and 712 can be added, and the twonetwork interfaces can be replaced by a single network interface whereinthe client traffic and the server traffic can be separated by the TCPprotocol stack. The TCP protocol stacks can be merged together (in manyconventional computer architectures there is a single TCP/IP protocolstack that handles multiple network adapters) or separated per networkadapter.

In addition, multiple server-side SRV's 718 can be added in order toprocess multiple network file protocols or different versions thereof.Similarly, multiple client-side RDR's 706 can be added in order tosupport multiple network protocols or multiple versions of such networkprotocol in interacting with the file servers.

Metadata File

A metadata file based switched file system aggregates files acrossmultiple file servers of a NAS array in order to increase performanceand to aggregate storage capacity. The subset of file servers of a NASarray that are used to represent a single user file is known as a filearray. Every file contained in the aggregated file system has acorresponding file array.

The model of metadata file aggregation is based on the file array. Fromthe point of view of the client, an aggregated file is seen as a singlefile. However, the switched file system views the file as multiplemetafiles and data files stored on multiple file servers in the filearray. “Metafile based aggregation” refers to aggregating the metafilesand data files that together store the metadata and data file of aspecified user file.

There are two classes of properties of an aggregated file: state andmetadata. The state properties are managed internally by the file switchin memory. These properties are used to describe the current state of afile such as current oplock level, access mode, and cache mode. Themetadata in general is shared between all clients of a single file. Eachproperty has an associated aggregation class. The aggregation classdescribes how a specific property is aggregated in relation to theelements of a file array.

Primary and Secondary Metadata File

The switched file system metadata for each aggregated file (also calledthe user file) consists of two separate metadata files: a primarymetadata file and a secondary metadata file. The Primary metadata filecontains various properties about a specific aggregated file, such asthe aggregation parameters, file paths to the data files that store thecontents of the aggregated file, and file attributes. The metadata fileattributes represent the aggregated file attributes (file attributes,creation date and time, etc.). The primary metadata filename is the sameas the aggregated filename except it is prefixed with the letter ‘P’.

The secondary metadata file is used only (or primarily) to store theaggregated size of the file. The size of the file is encoded in thefile's date/lime attribute fields, which are retrieved through a fileget information request. The secondary metadata file contains no data.The secondary metadata filename is the same as the aggregated filenameexcept it is prefixed with the letter ‘S’. For file systems that do notsupport date/time attribute fields large enough to store the file size,the file size may be stored in the primary or secondary file's data.

In an alternative embodiment, only the primary metadata file is createdand there is no secondary metadata file. In this alternativeimplementation, the aggregated file size is encoded directly in one ofthe primary metadata file's date/time attributes fields (e.g., thecreation date/time field).

FIG. 8 illustrates the contents of the primary metadata file 800 in apreferred embodiment. At a minimum, the primary metadata file 800contains the following elements:

-   -   A header 801 field for storing genuine file attributes that are        exposed to the user, such as creation, last access, and last        written dates and times. The header 801 is optional since much        or all of the header information may be stored in the directory        entry for the metafile.    -   A metadata offsets field 802 for pointing to various portions of        the metadata contained in the metadata file. This is used by the        aggregated file system for quickly accessing the portions of the        metadata. In alternate embodiments, the offsets field 802 can be        eliminated if fixed sized fields or fixed position fields are        used in the metadata file.    -   An aggregation descriptor field 803 that contains a header of        the descriptor 804, a stripe-mirror map 811, and a data stream        descriptor 813. The header of the descriptor 804 further        contains a flag that indicates whether the metafile is valid. If        the metafile is not valid, it should be ignored or updated to        become valid.    -   A number of stripes field 805 for indicating the number of        stripes into which the corresponding user file has been divided.    -   A strip size field 806 for indicating the size (in number of        bytes) of each strip.    -   A number of mirror field 808, which indicates the number of        copies (also called mirrors) of each stripe that are stored in a        file array.    -   A spillover field 809 for indicating whether there is any        spillover of the user file.    -   A number of data streams field 810 for indicating the total        number of data streams for the user file.    -   A matrix 812 of pointers to entries 830 in the data stream        descriptor. The size of the matrix is determined by the number        of stripes 805 and the number of mirrors 808 of the user file.        The matrix 812 contains an array of pointers (e.g., indexes into        the data stream descriptor), one for each distinct stripe-mirror        of the user file, to entries 830 in the data stream descriptor        813. For example, if a file has ten stripes and two mirrors,        there will be twenty distinct stripe-mirrors for that file. Each        instance of a stripe is sometimes called a stripe-mirror        instance, to emphasize that the data file containing that stripe        instance is for a particular mirror of the stripe. Each entry        830 in the data stream descriptor 813 includes, in turn, the        name 818 of (or a pointer to, or an identifier of) a file server        in which a stripe-mirror instance of the user file is stored. If        the stripe-mirror instance overflowed the file server, then the        entry 830 also identifies a spillover segment with a pointer        (index to next data stream) 815 to a next entry 830 that        describes the spillover segment.    -   A total file length field 820 for indicating the total        aggregated size of the user file. This field is optional,        although frequently helpful.        -   The entries 830 of the data stream descriptor array each            include the following fields:    -   A state of data stream field 814 for indicating whether the        stripe-mirror instance identified by an entry 830 is valid        (containing correct data), invalid (e.g., containing out of date        data) or does not exist.    -   An index to next data stream field 815 for linking to the entry        830 for a spillover segment. The index 815 is null when there is        no spillover segment.    -   A starting offset 816 within the aggregated user file for        indicating the starting location of the segment or segment        portion represented by the entry 830. When the entry 830        represents a stripe-mirror instance (i.e., a segment of the user        file) without a spillover segment, then the starting and ending        offsets 816, 817 are determined solely on the strip size and the        stripe number of the stripe represented by the entry 830. When a        stripe-mirror instance has one or more spillover segments, the        starting and ending offsets represent the starting and ending        positions of each of the segments that forms the stripe-mirror        instance. In an alternate embodiment, when a stripe-mirror has        not spilled over, the field 816 is set to 0 and the field 817 is        set to a special value (e.g., −1) to indicate a maximum value,        which allows the system to avoid modifying the metadata every        time data is written to the end of the file, and allows multiple        openers of the file to work more efficiently together.    -   An ending offset 817 within the aggregated user file for        indicating the ending location of the segment represented by the        entry 830.    -   A server name field 818 for indicating the name (or some other        identifier) of file server in the file array that stores the        file segment represented by the entry 830.    -   A global unique identifier field 819, containing a global unique        identifier (GUID) for the data stream of a stripe-mirror        instance corresponding to the entry 830. The GUID is used for        determining the directory structure in which the file segment        corresponding to the entry 830 is stored within a file server in        the file array. The GUID, in ASCII representation, is also used        as the file name of the data file(s) that stores the        stripe-mirror instance.

The metafile described above can be extended according to the needs ofthe switched file system. For example, in an alternative embodiment, adeleted file path field is included in the metadata file for indicatingthe location of a user file that has been deleted, but not yet removedfrom the file server. Saving the state of the deleted file path enablesthe trash bin functionality (which allows deleted files to berecovered). In addition, a security descriptor field may be included inthe metafile for indicating the access permission of a user file. Othertypes of metadata that are not described above may also be extendedaccording to the needs of the particular file aggregation and theparticular file system. The layout, structure and usage of the metadataare entirely up to the particular implementation of the switched filesystem.

Aggregation with Metadata File

One objective of the present invention is to aggregate file systemservices provided by conventional file servers and present them tonetwork clients as a single, large, very high performance network filesystem, the availability of which is many times higher than theavailability of each individual file server.

To achieve this objective, the file switch preferably aggregates alloperations of one or more network file protocols in such a way thatclients connected to the switch will not be able to distinguish itsoperation from the operation of a single network file server. Thisrequires the switch to aggregate all entities exposed by a typicalnetwork file protocol, in particular, the file system namespace,directories, and files. Clients connected to the file switch cannotobserve metafiles and data files separately. Rather, clients interactwith files, the files having both data (an array of bytes) and metadata(date, size, attributes, security descriptor, etc).

Rule-Based Aggregation

The mechanisms that the file switch uses to achieve file systemaggregation are preferably implemented such that they can be driven froma set of rules and policies defined on the file switch.

There are several attributes that make rule-based aggregation desirable.First, it allows a storage administrator to specify different ways ofaggregation for different sets and/or types of files, thereby easilytuning the characteristics of the system to the intended use and thespecific access patterns for different data. Second, it allows the fileswitch to operate with more deterministic timing by eliminating the needto consult external devices during normal operation.

In addition, rule-based operation allows multiple file switches toaggregate and be put in front of the same set of servers without thefile switches having to interact with each other, except to synchronizethe set of rules and policies whenever they are changed. This loosecoupling between file switches that aggregate the same set of fileservers makes it possible to scale access bandwidth by orders ofmagnitude, simply by adding file switches whenever needed.

Finally, since file switches are in an excellent position to track usagepatterns internally, they can be configured to adjust the aggregationrules (discussed below) automatically in accordance with policiesspecified by the system administrator and observed usage patterns. As aresult, the file switches can optimize in wide margins the distributionof files and data among the file servers to achieve smooth and adaptivebehavior of the network storage system as a whole.

Namespace Aggregation

Namespace Rules

In order for a file aggregator to redirect a file operation to theappropriate NAS array, it uses a set of namespace rules (also called thenamespace aggregation rules) to generate the corresponding NAS arrayfile path. Using the given file path accessed by a client and matchingnamespace rule, the NAS array file path can be generated by using a pathreplacement process. Before using path replacement, the aggregator mustselect the matching namespace rule for the given file path. Once therule is selected, the aggregator uses a path replacement process togenerate the proper NAS array file path. The path replacement processreplaces the client's file path with the NAS array file path.

FIG. 9 illustrates a rule-based namespace aggregation by the inventivefile switch to aggregate multiple file servers under a common filesystem namespace. The rules for namespace aggregation are preferablydefined as a table of path correspondences. The first column specifiesthe names visible to the clients, the second column specifies the nameof the file server and, optionally a shared mount point on that serversin which the files actually reside. A file switch is shown connected tothree file servers 908, 909 and 910. Loaded within (or otherwiseaccessible by) the file switch is a rule table 904 that specifies threerules 905, 906 and 907. The path names 901, 902 and 903 of incoming filerequests, such as file open requests, initiated by a network client arecompared to the name-mapping rules in the first column (preferably thecomparison is done either by matching longest prefixes first, or byapplying the rules in a predefined order of priority, so thatoverlapping pathnames can be specified). If a match is found, thematching portion of the file base path is replaced with the name fromthe second column and the request is forwarded to the new path forprocessing. Once a file is open on the target server, all furthertransactions related to this file are switched to that server.

For example, rule 905 specifies that the \ENG subtree of the commonnamespace is to be mapped to the server 908. File 901 will match thisrule and therefore will be switched to the server 908 where it willarrive with a modified path. However, rule 906 specifies that a subtreewithin the \ENG subtree, namely \ENG\SW, is to be mapped to a differentserver, server 909. File 902 satisfies this rule and will therefore beswitched to server 909, where it will arrive with a modified path. Inaddition, rule 907 specifies that the \ACCT subtree is to be mapped toserver 910. This rule will drive the switching of file 903 even thoughthis file resides in a subdirectory of the \ACCT subtree (because of theprefix match).

In addition to base path, other namespace mapping rules arecontemplated. For example, a rule may specify that all files with agiven extension (and, optionally also under a given subtree) areswitched to a specific server. For example, a rule(*.mpeg-->\\srv3\dir6) will cause all MPEG files to be sent to thesubdirectory dir6 on server SRV3 910, no matter where in the logicalnamespace these files reside.

One skilled in the art will recognize that although the above exampleillustrates a method for mapping a particular file type to a particulardirectory of a specific server, this method can be generalized toinclude a “file system name” plus a “target directory”. For example, thefile system name may identify a NAS array 310 or a legacy server 313.This generalized method is used in the determination of NAS array asdescribed below in FIG. 14.

It should be noted that the new path created by the application of thenamespace aggregation rules is the file path for the metadata filecorresponding to the specified user file. Access to data within the userfile is redirected to other file servers, and to specific directoriesand data files within those directories, in accordance with the metadatain the metadata file. This will be explained in more detail below.

Note that by aggregating the namespace of multiple file servers into acommon namespace, the file switch achieves a function similar to whatavailable distributed file systems do without requiring any proprietaryclient-side software.

Name of a Data Stream

Each aggregated file consists of one or more data streams that containthe file's data. The number of data streams depends upon the number ofstripes and mirrors for the specific data file, as well as the number ofspillover fragments (as explained in more detail below). The name of adata stream is the ASCII code (i.e., the ASCII representation) of theglobal unique identifier (GUID) stored in the corresponding entry 830 ofeach data stream. This ensures the name for each data stream is uniquebecause of the uniqueness of the GUID. FIG. 15 illustrates an examplewhere the above naming methodology is observed. The data stream namesfor the document myFile.doc 1500 are formed using the ASCII code of theGUID of the corresponding data stream. For example, the name for thefirst data stream on file server 1501 is the ASCII code of the GUID forthis entry (namely GUID_ASCII_(—)1) and similarly, the names for thefirst data stream on file servers 1502 to 1506 are the ASCII codes ofthe GUID for the respective entries, namely GUID_ASCII_(—)2,GUID_ASCII_(—)3, GUID_ASCII_(—)4, GUID_ASCII_(—)5 and GUID_ASCII_(—)6.Note that the mapping is configured and performed on the file switch.The clients don't need to know, and in fact have no way of knowing, themapping and do not need to be reconfigured if the mapping is changed.

Data Aggregation Rules

The ability to aggregate data files among multiple servers and to do sosafely in a concurrent environment enables the file switch to distributethe data of the aggregated file on multiple servers, thereby achievingboth parallel operation and high availability. The same process can beviewed as the file switch aggregating the contents of the member filesinto a single file that it presents to its network clients.

Most network file protocols represent data file as contiguous arrays ofbytes. This means that the techniques required to distribute the datafor each individual file are not different from the techniques requiredto distribute the data for an array of hard disks. In accordance withthe present invention, the methods for doing so, including striping,mirroring and other variations of RAID, are applied to distributing dataof individual files across a set of file servers.

FIGS. 10-12, described hereinafter, respectively illustrate mirroring,striping, and spillover as implemented by the present invention. Asthese mechanisms exist conventionally, a representation of the clientsand servers is not believed necessary. It is noted, however, that thesemechanisms are performed by the present invention based on switchingfile protocol transactions that take place in the file switch(represented by the arrow in each of these figures), rather than APIfunctions that take place on a local machine, typically the client.

Mirroring

FIG. 10 illustrates data aggregation through mirroring in a switchedfile system. In this example, the file switch (not shown) aggregatesmember files 1001, 1002, 1003 and 1004, all preferably residing ondifferent file servers, into a single aggregated file 1000, presented tothe clients. The member files 1001 through 1004 contain identical data,which the switch presents as contents of the aggregated file 1000.

When the client initiates a file open transaction, the switch aggregatesthat transaction (as shown in FIG. 10) and opens either one or all ofthe member files 1001 through 1004, depending on the type of operationthat is to be performed subsequent to the file open. When the clientinitiates a file open and a file read transaction, the file switchselects, preferably randomly, one of the file servers on which themember files reside and switches the open and read transactions to it.That server executes the open and read transactions and returns theresponse to the switch; the switch forwards the response to the client,thus completing the read transaction requested by the client. With thismechanism, if multiple clients try to read the same file 1000, the fileswitch will direct their transactions to different member servers atrandom (or in accordance with predefined criteria, such as loadbalancing criteria). The switch thus balances the load among these fileservers. In addition, the clients can experience up to four timesincrease in performance compared to a situation where the file 1000 isstored on a single server.

When a client initiates a file write transaction, the switch aggregatesthe transaction by replicating the user data into all of the membertransactions. As a result, all member files 1001 through 1004 areupdated synchronously with the same data. Since all member transactionsexecute in parallel, this does not significantly degrade the performanceof write transaction on the aggregated file compared to writetransactions on a file stored on a single server.

Finally, when a client initiates a close transaction, the switchaggregates it in a manner similar to the open transaction and closes allmember files.

One other significant advantage of file mirroring is that the abovetransactions can be completed successfully even if one or more of themember file servers become unavailable. Open, write and closetransactions are switched to all available servers; read transactionsare switched to any one of the available servers. This way, as long asat least one of the member files is online, the file system as a wholeand the aggregated file 1000 in particular remain available to allclients.

Striping

FIG. 11 illustrates data aggregation in a switched file system throughstriping by a file switch. In this example, a user file 1100 contains 6file strips 1105 through 1110. The file switch (not shown) distributesthe user file into 4 stripes 1101 through 1104, all preferably residingon different file servers, according to a predetermined number ofstripes 805. The stripes 1101 through 1104 in this case containdifferent, non-overlapping strips 1105 through 1110, which the fileswitch presents as a contiguous aggregated user file 1100.

When a file switch receives a file open transaction from a client, itaggregates that transaction (as shown in FIG. 11) and opens thecorresponding metadata file. From the metadata file, the file switchdetermines the number of stripes and the file server locations of thedata files containing the stripes. By placing an appropriate lock on themetadata file, the file switch can furthermore prevent other clientrequests from interfering with the operation of the current clientrequest.

When the client initiates a file read transaction, the switch aggregatesthis transaction by executing the following steps. First, determiningbased on the strip size and the requested starting offset and therequested transaction size, which of the member servers will be involvedin the transaction, and at what starting offset and what amount of dataeach of them must read. The switch then issues the member transactionsto the selected servers and aggregates the results by ensuring that dataarrives at the client in the right reconstructed order. The clientreceives the aggregated header for the response, followed by all of thedata requested, in the correct order.

One skilled in the art will recognize that the write transaction in thiscase is executed in a manner similar to the read transaction describedabove, except that the data is distributed as illustrated in FIG. 11,instead of being assembled as was the case with the read transaction.Finally, when a client initiates a close transaction, the switchaggregates it in a manner similar to the open transaction and closes thecorresponding metadata file, as well as any of the stripe data filesthat have been opened.

In the case of data aggregation through striping, both read and writetransactions are aggregated by submitting corresponding read and writetransactions for smaller amounts of data to multiple member servers inparallel. This results in a respective increase of performance, whichthe file switch can deliver to each individual client, as well as to anexcellent load balancing in the case of multiple clients accessing thesame file. In addition, as multiple studies have shown, striping tendsto resolve the problem of hotspotting.

Spillover

FIG. 12 illustrates data aggregation through spillover. The spillovermechanism is preferably used to aggregate storage capacity, preferablyin conjunction with one or more of the other mechanisms describedherein. The spillover is especially useful in cases where one or more ofthe member servers for an aggregated file unexpectedly run out of diskspace while the file is open. The figure illustrates an aggregated file1200, comprising two member files 1201 and 1202, preferably residing ondifferent file servers. As seen from the figure, sections 1, 2, 3, and 4of the aggregated file 1200 reside in member file 1201, while theremaining sections 5 and 6 reside in member file 1202.

Spillover happens when the file switch, in the process of writing datainto a file unexpectedly discovers that the target file server is aboutto run or has run out of disk space. In such case, rather than failingthe write transaction, the switch may elect to open a new member file onanother server and continue writing into it. The contents of the twofiles are concatenated to present a common contiguous byte array in anobvious way. One skilled in the art will recognize that the spillovermechanism can be applied to the second file as well, creating anarbitrarily long chain of member files, so that all disk capacity in thesystem can be fully utilized if needed.

The file switch switches file transactions to spilled-over files asfollows. For read and write transactions, the file switch looks at thestarting offset and the length of the payload to be read/written andswitches the transactions as follows:

-   -   (a) if the payload fits completely within the first member file        (e.g., segments 1 and 2 from file 1200), the file switch        switches the transaction to the first server.    -   (b) if the payload fits completely within one of the spillover        (second and further) member files (e.g., segment 5 from file        1200, which is stored in the beginning of the member file 1202),        the file switch switches the transaction to the server on which        that member file resides. The switch also modifies the        parameters of the transaction by subtracting from the starting        offset for the transaction the starting offset of the member        file within the aggregated file. In our example, segment 5 is at        offset 0 in file 1202, so four segments should be subtracted        from the request, resulting in a request to read the first        segment from file 1202.    -   (c) if the payload spans multiple member files (e.g., segments 4        and 5 from file 1200), the file switch replicates the        transaction to all servers on which portions of the request        reside, modifying the starting offset and length of each        transaction. Upon receiving the responses, the file switch        reconstructs the data in the correct order (similar to the way        this is done for striping) and sends it back to the client.

In order for the spillover mechanism to function, the metadata filestores the range of data file and the location of the member files inthe file system (i.e., the server on which each member file resides andthe file name and file path of the member file). This same informationis obtained from the metadata file during read and write or updateoperations.

According to the present invention, the file switch aggregates data fileon a file-per-file basis. In this way, different files can be aggregatedin different ways using different combinations of striping, mirroringand other data aggregation techniques to achieve optimal balance betweenperformance, storage utilization and the desired level of dataavailability.

It is well known that the effectiveness of striping, mirroring and otherdata aggregation techniques when applied to block devices, such as inRAID or parallel file systems, can be greatly diminished by the factthat no single solution can fit all types of files and access patterns.By way of example, streaming video can be striped very effectively overa large number of devices, since streaming data is usually being read inlarge segments. On the opposite side of the spectrum, HTML files aretypically only a few kilobytes large and not a good target for striping.Therefore, the present invention utilizes aggregation rules (also calledthe data aggregation rules) to configure the file switch with differentdata aggregation parameters for different types and/or sets of files.

Syntax of Data Aggregation Rules

FIG. 13 illustrates the syntax of data aggregation rules and providesexamples of such rules. The preferred syntax 1300 defines a set ofaggregation parameters, namely, number of mirrors, number of stripes(i.e., the preferred number of file servers across which the stripes arestored) and strip size, which are selected for a given set of filesbased on each file's path (location in the aggregated namespace) andtype (recognized by the file extension/suffix).

Rule 1301 shows typical parameters for MPEG files located anywhere inthe file system. The rule is selected for any file path, but only forfiles whose filename extension is MPEG, and it defines mirroring by 2,striping by 32 and a strip size of 16 KB. With this rule, any MPEG filewill be mirrored once (two copies of the data will exist in the system)and striped across 32 file servers, with a file strip size of 16kilobytes.

Rule 1302 shows typical parameters for HTML files located anywhere inthe file system. The rule is selected for any file path and only forfiles whose filename extension is HTML, and it defines mirroring by 64and no striping. With this rule, any HTML file will be mirrored on 64file servers, which allows load balancing when read by large number ofclients simultaneously (which is the typical access pattern for HTMLfiles on a HTTP server).

Rule 1303 shows typical parameters for Microsoft Word document fileslocated anywhere in the file system. The rule is selected for any filepath and only for files whose filename extension is DOC, and it definesmirroring by 3, striping by 8 and a strip size of 8 KB. With this rule,any document file will be mirrored twice (three copies of the data willexist in the system for higher availability) and striped across 8 fileservers, with a file strip size of 8 kilobytes. Since most suchdocuments typically have file sizes between 32 KB and 100 KB, this ruleprovides moderate (e.g., 4×) improvement in performance for eachindividual client, and lowers the probability of hotspottingsignificantly since each file is spread across a total of 24 fileservers (if that many file servers are available) without wasting toomuch storage space.

Rule 1304 shows a desired set of aggregation parameters for softwaresource code files that contain valuable intellectual property whilebeing each small in size. The rule applies to any file in the \CODEBASEsubtree of the aggregated namespace, and defines mirroring by 4 and nostriping. This provides moderate performance increase (e.g., 4×) duringprogram compilation and build, which is the usage pattern where hundredsof files are being read in a batch process and provides excellentprotection from data loss due to server failure.

Finally, rule 1305 is a modification of rule 1304 that optimizes the useof storage space in the \CODEBASE subtree. This rule recognizes the factthat source code directories often contain intermediate object codefiles (with file extension of OBJ) which are a byproduct of thecompilation process and can easily be reconstructed if lost. The ruledefines an exception from rule 1304, namely that any file in the\CODEBASE subtree that has a filename extension of OBJ will be neithermirrored nor striped. When used together, rules 1304 and 1305 can easilyprovide optimal storage characteristics for a software engineeringdepartment.

In another embodiment, the data aggregation rules contain additionalparameters. In particular, the syntax of the data aggregation rules inthis embodiment is:

-   -   (Path, Type)→(N Mirrors, N Stripes, Strip Size, operational        parameters, caching parameters)

The operational parameters may include, for example, a lock redundancyparameter that specifies the number of file servers on which file lockare to be replicated. The caching parameters may include a “read aheadenabled” parameter, which indicates whether read ahead caching (i.e.,retrieving and caching data from a file before it has been requested byan application running on the client computer) is enabled for the filesto which the aggregation rule applies. The caching parameters mayinclude a “write behind/write through” parameter, which indicates (forthe files to which the rule is applicable) whether new and updated datais lazily written back to the file servers, or is written backimmediately. The caching parameters may also include caching parametersthat specify one or more of a maximum cache size, a maximum cachingtime, a maximum amount of dirty data that can be cached withoutwriteback to the file server (if write behind is enabled), and so on.

Summary of Data Aggregation Rules

This section has described the various mechanisms, algorithms and otherelements of the present invention used to achieve the desired behaviorof the file switch, namely the ability to aggregate multiple independentfile servers into a single, highly scalable switched file system.

One skilled in the art will easily recognize that the mechanismsdescribed in this section can be beneficially applied simultaneously tothe same file. For example, mirroring and striping can be combined toincrease both performance and availability of a single file; further,spillover can be added to the same file in case some of the file serversrun out of storage space. Moreover, one skilled in the art willrecognize that other data aggregation techniques, for example RAID4 andRAID5, can be implemented in a file switch in addition to or instead ofthe mechanisms described herein.

Director Aggregation

Namespace aggregation as described above is an easy way to distributefiles among different servers, and also to add a new server to anexisting system. However, this technique alone may not be sufficient toaggregate seamlessly the storage capacity of multiple file servers. Forexample, with namespace aggregation alone it may not be possible to tellhow much free disk-space is available on the aggregated file system.

Since different directories are mapped to different servers, a file thatcannot be stored under the \ENG subtree for lack of room may besuccessfully stored under the \ENG\SW subtree, which resides on adifferent server. Thus, even when the system as a whole has plenty ofavailable storage space, particular file operations in particular placesin the namespace may not be able to execute successfully withoutextensive human intervention.

Directory aggregation resolves the above issues by making it possible todistribute files that reside in the same aggregated directory amongdifferent servers. This ensures that the files from all directories ofthe combined namespace can share all of the available free disk space.

Directory Structure of Metadata File

In order to determine the directory structure for storing the metafileof a user file in the group of file servers, the file switch needs toconstruct the following:

-   -   [NAS artay][file server][directory path][filename]

FIG. 14 illustrates a method for constructing the directory structure ofa metafile. The method consists of the following key steps:

-   -   1. Determine NAS array 1404: The aggregator needs to first        determine which NAS array should be used. This determination is        based on the namespace rules. The file path being accessed is        mapped to a specific NAS array and directory path in accordance        with the namespace rules, as described above.    -   2. Determine File Servers 1406: The file server (more        specifically the set of file servers) that contains the metadata        file is determined by using a hash function (e.g., by applying        it to the user file name) to identify a first file server. The        set of additional file servers for storing redundant copies of        the metadata file is determined simply by selecting the “next”        N−1 file servers in the NAS array, when a total of N file        servers are needed. If the number of servers in the array is        reached, the counting wraps around to the first server. The        metadata redundancy N is independent of the number of stripes        and number of mirrors. N can be set as a constant on the NAS        array, or be set per subtree in the namespace aggregation rules        (e.g., by adding a metadata_redundancy field to each aggregation        rule.    -   3. Determine Directory Path 1408: The directory path for a        metafile is calculated using the namespace aggregation rules and        the file path (of the associated user file) provided with the        request. Parts of the file path may need to be replaced        depending on the namespace aggregation rules. The constructed        directory path is replicated according to the number of        redundant metafiles, which in some embodiments is defined by the        namespace aggregation rules.    -   4. Determine Metafile Names 1410: The file names of the primary        and secondary metafile stored on the file server are the same as        the user file name, with a prefix of “P” for the primary        metafile and a prefix of “S” for the secondary metafile        respectively.

The NAS array in which the metafile is to be stored is identified by thenamespace aggregation rules. There may be multiple NAS arrays in a givenfile system. Each NAS array is responsible for specific directories andfiles as described by the rules. Directory aggregation applies to aspecific NAS array; not all NAS arrays as a whole. The full set of fileservers that makes up the NAS array must be known to the file switch(e.g., a background service may keep track of this information). Eachfile server in the array is identified by its computer name on thenetwork and a share (server's file system mount point) in which filesshould be stored. In order to access a file stored on a given server,the pair <server, share> is needed. Since every server preferablyparticipates with a single share in the NAS array, the pair <NAS array,server> is sufficient to identify <server, share>. The <server, share>pair for each server that participates in the NAS array is listed in theconfiguration of the NAS array.

A hash function is used to determine the first file server in the NASarray that contains a specific metafile. The hash function is applied tothe name of the file (preferably not including the file path). The valueof the hash is used to determine which file server contains the firstoccurrence of the metafile. The hash function is configured to produce avalue in a range of numbers equal to the number of file servers in theNAS array, where each value in this range represents one of the fileservers in the array. This mechanism evenly distributes metafiles acrossthe NAS array. The hash function, used in conjunction with the namespaceaggregation rules, determines the exact subset of file serverscontaining the specific metafile.

To one skilled in the art, it will be apparent that it is possible toset the metadata redundancy N to 1 in which case the directoryaggregation achieves only distribution without redundancy. It is alsopossible to set the hash function to always return the value associatedwith the first server in the NAS array, thereby achieving only metadataredundancy. However, it is highly beneficial to use both redundancy anddistribution of the metafile, to improve data security and availability.

The components of the array configuration are used to aggregate filesand directories across the NAS array. Below is a simple example;

-   -   Namespace rule: \ENG\DOCS\*.*>NAS3\DIR4\DATA    -   Client requested file: \ENG\DOCS\JOHN\myFile.doc    -   Value of file hash: second server in NAS array    -   Configuration entry for the second server in the NAS array NAS3:        server SRV2, share SH1

Using the above information, the client file path “\ENG\DOCS\myFile.doc”is translated into “\\SRV2\SH1\DIR4\DATA\JOHN\myFile.doc” on the thirdNAS array, NAS3 (“SRV2” is the name of the second server in the NASarray NAS3). The directory “\DIR4\DATA\JOHN”, if it doesn't alreadyexist, is created on all members of the NAS array, not just the memberscontaining the metafile for file “myFile.doc”, to support directoryenumeration and metafile redundancy.

This example pertains to both opening and creating files. When accessingthe file on the NAS array, the metadata files involved are:

-   -   NAS3\DIR4\DATA\JOHN\Pmyfile.doc—primary metadata file    -   NAS3\DIR4\DATA\JOHN\SmyFile.doc—secondary metadata file

FIG. 15 illustrates a graphical representation of the storage of theuser file and metadata files for an aggregated user file named“myFile.doc”. There are six file servers 1501 to 1506 in the file array.The user file is divided into six stripes. In this example, no mirrorsof the user file are shown.

The primary and secondary metadata files (PmyFile.doc and SmyFile.doc)are stored in the first file server 1501 of the array. The metadatafiles are replicated one time in file server 1502 to provide redundancy.

Directory Structure of a Data File

The data files are preferably stored on servers of the same NAS array asthe metadata files but in a different directory sub-tree, separate fromthe metafiles. A “file array” is the subset of file servers in a singleNAS array that stores the contents of a specific file. This sectiondescribes how to create the directory structure of data files within afile array.

User File Data Distribution Mechanism

FIG. 16 illustrates a preferred embodiment for distributing the data ofuser files in a NAS array. The method consists of the following steps:

-   -   1. Determine NAS array 1604;    -   2. Determine the number of file servers 1606;    -   3. Select File Servers and Perform Load Balancing 1608;    -   4. Determine and Handle Spillovers 1610;    -   5. Create Global Unique Identifiers (GUID) 1612;    -   6. Determine File Path with GUID 1614;    -   7. Create Data Stream Filename 1616;

The method starts in block 1602 and moves to block 1604 where mapping ofa user file to the proper NAS array is performed. The method uses thenamespace rules described above. This method is the same as fordetermining the NAS array for storing the metafile.

In block 1606, the number of file servers to be used to store the dataof the user file is determined. The method applies the aggregationrules, which specify the number of stripes and the number of mirrors. Inone approach, the number of servers is computed by multiplying thenumber of stripes by the number of mirrors. However, in the event thatthere is an insufficient number of file servers to store each mirroredstripe of the user file, multiple stripes (i.e., stripe instances) canbe stored in a single file server.

In block 1608, the number of file servers computed in block 1606 isselected from the NAS array. There are numerous selection methods thatcan be applied to select the file servers for achieving the goal of loadbalancing in storing the user file. In one selection method, called theround robin method, each file server within the NAS array is selectedsequentially for storing a mirror-stripe file for the user file. Whenmultiple copies of each stripe are to be stored, each instance or copyof the stripe must be stored on a different file server. In otherselection method, based on the available disk space on the file servers,the file server with the largest available disk space is selected first,and then the file server with the next largest available disk space isselected second. The process continues until all the stripes of the userfile are stored. Yet another method for selecting the file servers canbe based on the historical load statistics of a particular file server.Yet another method for selecting the file servers can be based on theresponse time of the file servers.

In block 1610, the method determines and handles any spillover fragmentsof the stripes that form the user file. While aggregating files tomultiple devices, over time some of the device's storage capacity maybecome exhausted. As a result, the file aggregation may fail and causedisruptions in the systems network. To avoid such failures, fileaggregation includes spillover. This is a mechanism that allows theaggregator to use a different storage device (i.e., file server) whenone or more of the devices run out of storage space. Each file server'sstorage capacity must be monitored using a specific threshold. Thethreshold varies depending on the storage capacity of the file server.The threshold is needed so a portion of the storage is preferablyreserved for file spillover information and metafiles. Note that whenthe user file is first created, the determination step will show that nospillover fragment exists, and hence the handling spillover step willnot be performed.

When the file aggregator detects that a particular file server hasreached its threshold (i.e., the file server's disks are full), adifferent file server is designated for all subsequent data belonging tothe accessed data file. One approach to storing the spillover fragmentsof a user file is to store the spillover data file in the subsequentfile server, in a predefined sequence of the file servers with the NASarray. The sequence of the file servers wraps around when the last fileserver is reached. Whenever possible, the aggregator preferably avoidsstoring a spillover fragment of a given stripe's mirror on the sameserver where another mirror (or fragment thereof) of the same stripe isalready stored; this allows the aggregator to preserve data redundancy.

By allowing directories and their contents to spillover on the servers,the capacity of the entire NAS array can be used for file storage.

For a given file, there is either spillover or no spillover, asindicated by the spillover flag 809 in the metafile for the user file.If there is no spillover, the flag indicates that there is no spilloverand that each stripe-mirror instance is represented by a single datastream. If there is spillover, the flag indicates so, and the spillovercontents of a stripe are stored on another server using a new GUID (seeGUIDs below); the determination of the file path of the new data streamis described below, with reference to FIG. 17. As long as at least onestripe-mirror instance has been spilled over, the spillover flag is set(in some embodiments, however, the spillover flag may be eliminated).The primary metadata file is updated to include pointers to the full setof spillover fragments. In addition, all redundant metafiles must beupdated to include entries 830 for each spillover fragment.

To indicate that an aggregated file has spillover, its primary metafileis updated with the following information:

-   -   Spillover flag 809 is set, to indicate that the file has at        least one spillover.    -   Total number of data streams, which is stored in field 810 of        the metadata file, as shown in FIG. 8. This parameter indicates        the total number of data streams for the aggregated file,        including the first fragments of each stripe-mirror instance and        any spillover fragments of any stripe-mirror instance.    -   List of all data streams which include (<stripe #>, <mirror #>,        <start offset>, <end offset>, <logical device name>). More        particularly, each data stream is represented by an entry 830 of        the data stream descriptor 813 in the metadata file, as shown in        FIG. 8. The entry 830 for the initial fragment of a        stripe-mirror instance is identified in the stripe-mirror map        811, more specifically by a data stream index value stored in        the matrix 812 by stripe number and mirror number. Once the        first data stream has been spilled over, the first spillover        fragment is linked to by the “index to next data stream” 815,        and if there are any additional spillover fragments for the same        stripe-mirror instance, these are found by following the links        in the index field 815 of successive entries 830.

The spillover information in the metafile is preferably stored in theorder that the spillovers occur. A full stripe of a file is aconcatenation of all of the stripe fragments, including an initialfragment file and zero of more spillover fragment files, in the orderthat they are listed in the metafile. Each fragment file is stored onone of the NAS devices, as indicated by the server name 818 in the entry830 representing the fragment file. The file name for the fragment isindicated by the GUID field 819 in the entry 830 for that fragment file.

When accessing a file contains spillover data, the file switch checks ifthe needed data is on the regular file server for a particular stripe,or a spillover file server, or both. The file's metadata is used todetermine which file servers contain the spillover data. There may beany number of spillover file servers in the NAS array.

In block 1612, the global unique identifier (GUID), a value that is 16bytes long in a preferred embodiment, is created for each distinctfragment (data stream file) of the user file. The length of the GUID maybe different in other implementations. The GUID for each data streamfile is stored in a descriptor field 819 of the corresponding entry 830in the metadata file. FIG. 17 illustrates a method for creating theGUID. The inputs 1702 for creating the GUID consist of a unique MACaddress of a network interface, a time stamp and a sequence counternumber. In other embodiments, other information or additionalinformation (e.g., the filename) could be used as input to the GUIDfunction 1704. The MAC is the unique network address of one of the fileswitch's network interfaces (and uniquely identifies the file switchamong all other file switches); the time stamp indicates the time of theuser file creation and the sequence counter counts the number of filescreated by the file switch. The GUID function 1704 combines the inputsto create a unique bit stream that is written into the GUID 1706. TheGUID is preferably unique among all the GUIDs generated by any fileswitch, on any NAS array, on any server.

In block 1614, the file path, within a file server, for each data file(i.e., each stripe-mirror instance file and spillover file) isdetermined using the GUID for that data file. FIG. 17 illustrates oneapproach to implement this step. In block 1706, the GUID is divided intomultiple bitfield segments, herein called indexes, namely index 1, index2 and up to index n. The directory path to the data stream file isformed by concatenating a subset of the indices to form a file path,with each utilized index comprising a directory name in the file path.For example, the GUID of a data file may contain indices A, B, C, D andE, as well as other portions not used in the file path. In oneembodiment, each index from the GUID comprises one or two ASCIIcharacters. The file path for the data file is then \A\B\C\D\E\filename.As shown in 1708, each index from the GUID forms the name of a directoryin the file path of the data stream. By forming the file path of each ofthe data streams in this way, the data streams are automatically andrandomly (or pseudo-randomly) spread over a large number of distinctdirectories, thereby preventing large numbers of data streams from beingstored in a single directory. Having large numbers of data streams inthe same directory could have an adverse impact on system performance,and this file path forming mechanism avoids that potential problem.

In block 1616, the file names of all the data streams of eachstripe-mirror instance of the user file in the file array aredetermined. In normal operations, each aggregated file consists of oneor more stripe-mirror instances. The number of stripe-mirror instancesdepends on the number of stripes and mirrors for the specific user file.The number of data streams for each stripe-mirror instance depends onthe number of spillovers for the specific stripe-mirror instance. Thedata streams are named using the ASCII code of the GUID associated witheach corresponding data stream, with two ASCII characters for each byteof the GUID. This was described above in detail with reference to FIG.15. Other methods can be used to convert the GUID into valid filenamesusing characters allowed by the file servers; one such method is toconvert the number in a base-62 system, where the digits are 0-9,followed by all uppercase letters of the English alphabet, followed byall lowercase letters (10+26+26).

Note that the mapping of the data files (that together form the data foran aggregated file) to file servers, and to specific directories on thefile servers is performed by the file switch. The clients don't need toknow, and in fact have no way of knowing, the mapping and do not need tobe reconfigured if the mapping is changed.

After the step of determining data stream file names in block 1616, themethod ends at block 1618.

It should be pointed out that in other embodiments, the steps of FIG. 16may be performed in a different order. Further, many of these steps maybe performed or re-executed each time the user file increases in sizesufficiently to require that addition of a new data stream for the userfile.

Example

The following example illustrates how the directory structure for theuser file is determined. This example assumes the following:

-   -   One file aggregator (i.e., file switch) and 2 different NAS        arrays NAS1 and NAS2. Each NAS array contains 8 file servers.        The names of the file servers in NAS1 are NAS1_SRV1, NAS1_SRV2,        NAS1_SRV3, etc. The names of the file servers in NAS2 are        NAS2_SRV1, NAS2_SRV2, NAS2_SRV3, etc.    -   The following namespace rules are defined:        -   Rule 1: \ZF\ENG\DOC\*.*→NAS1\DOC\_DIR        -   Rule 2: \ZF\ENG\DESIGN\*.*→NAS2\DESIGN_DIR        -   Rule 3: \ZF\ENG\TRAINING\*.MPG→NAS2\MOVIES    -   The following aggregation rules are defined for NAS1:        -   Rule 1: \DOC_DIR\*.*→{stripe (4, 8192), mirror (1)}    -   The following aggregation rules are defined for NAS2;        -   Rule 1: \DESIGN_DIR\*.*→{stripe (4, 8192), mirror (1)}        -   Rule 2: \MOVIES\*.*→{stripe (8, 16384), mirror (0)}

Assuming the client requests to access the file “\ZF\ENG\DOC\GEARS.DOC”:

-   -   According to namespace rule 1, this path is mapped to the first        NAS array NAS1 to the directory “DOC_DIR”. The application of        this namespace rule identifies the location where the metadata        file for the user file is located.    -   According to the aggregation rule 1 for NAS1, “DOC_DIR” is        striped over 4 servers, each stripe is 8K and each stripe is        mirrored 1 time on the other 4 servers in the NAS array.

Let HashFunction(GEARS.DOC)=0. In this case, the first server containingthe file “GEARS.DOC” is NAS1_SRV1. Additional file servers, foradditional stripes and mirrors are identified using this first server asa starting point. Alternately, the file servers to be used to store thedata files are identified using a load balancing function. Further, eachcopy of a stripe data file must be stored on a different file serverthan the other copies of the same stripe, in order to provide protectionagainst file server failures, and to provide parallel data paths forimproved throughput.

-   -   A separate GUID is computed for each distinct data stream of a        user file. Thus, a respective GUID is computed for each data        stream of a stripe-mirror instance, and if there are spillovers,        a separate GUID is computed for each spillover segment. From the        GUID for each data stream, a file path is generated, and each        data stream is stored in the determined file server at the file        path determined from its GUID.        Isomorphic Trees

In order to implement directory aggregation, described below, theaggregated directory structure is preferably present on all servers ofthe NAS array. Each file server preferably has the same directorystructure (also called a directory tree) under the share exposed forthis server in the NAS array. Having isomorphic directory trees enablesmetafiles to be stored on any server in the NAS array. Each file serverneed not have the same metafiles.

In order to ensure that each file server has the exact same directorystructure, for each directory create request received from the client,the aggregator must create the specified directories on all the fileservers. The aggregator (i.e., the file switch) extracts the directoryportion of the file path and creates the same directory structure on allfile servers in parallel.

In case the network file system semantics allows creating files withouthaving to pre-create their directories, the file switch creates thedirectories on all servers (at least all servers that can be used tostore metafiles), regardless of where the metafile is created. As anexample, if the file path being created is “\eng\doc\archive\mydoc.doc”,the aggregator must create the parent directory “\eng\doc\archive” onevery file server in the appropriate NAS array where the file“mydoc.doc” is to be stored.

Load Balancing at the File Switch Level

FIG. 18 illustrates a mechanism provided by the present invention forload balancing at the file switch level. Since all file switches withinan aggregated file switch provide access to the same set of files, anyclient may be connected to any of the file switches. This allows clientsto be distributed among the file switches so that not all clients areconnected to the same file switch. This can be achieved by manuallyconfiguring each client to use a particular file switch or byautomatically distributing the clients when they try to connect to theaggregated file switch 1803.

The selection of which particular file switch is going to serve a givenclient happens when the client connects to the file switch. Thisassociation preferably does not change for the duration of the clientconnection.

The load distribution is preferably done through a name resolutionservice, such as DNS or WINS, that provides a mapping between a name(configured as server name for the clients) and the IP address of aparticular file switch.

One possible mechanism is to have the group 1803 be assigned a separateDNS subdomain (e.g., zx1.z-force.com). File switch 1801, which isconfigured as a group controller also acts as a DNS server for thatsubdomain. The subdomain preferably contains two host names, such asadmin.zx1.z-force.com and zx1.z-force.com. The nameadmin.zx1.z-force.com is used for management, the host namezx1.z-force.com is used for file serving (i.e., this is the name towhich clients connect). The group controller always resolves theadmin.zx1.z-force.com host to itself. It resolves the zx1.z-force.comhost name dynamically. In different embodiments, the zx1.z-force.comhost name is resolved to a respective file switch on a rotating basis, arandom basis, on the basis of the number of users connected to each ofthe file switches, or on the basis of the current transactional loadsbeing handled by the file switches in the group (the file switches mayreport their load factor periodically to the group controller 1801). Asa result, different clients end up on different switches. Each of theswitches may also have a unique name in the subdomain (e.g.,switch3.zx1.z-force.com).

In an alternative embodiment, the group controller can be a dedicateddevice instead of the file switch 1801.

Another mechanism for load balancing is for each file switch to have adifferent server name and IP address. The system administrator canconfigure different groups of clients to connect to different fileswitches (e.g., based on company structure), or use a third-party loadbalancer or round-robin DNS such as RRDNS.

Yet another mechanism that can be used by the file switches belonging tothe same group is to configure the switches with the same server name(e.g., the CIFS server name), and have that name registered as a groupname instead of an individual host name. When a client tries toestablish a connection to that name, the first switch able to respondwill get the client connection. Since typically this will be theleast-loaded switch, this mechanism can also be used for load balancing.

One skilled in the art will recognize that other mechanisms can be usedto achieve load balancing. One skilled in the art will also recognizethat combining a load-balanced front end with independent connections onthe back end of the file switch allows practically unlimited scaling upof the bandwidth of the network file system, simply by adding fileswitches to the group 1803. In such case, one may also increase thenumber of file servers to which the file switches connect as needed toachieve the desired aggregate performance.

Transaction Aggregation

FIG. 19 illustrates transaction aggregation by a file switch. Fileswitch 200 receives a file read request 1901 from a client connectedthrough connection 209. The switch determines the subset of file serverson which instances of the aggregated file reside, preferably by usingthe aggregation descriptor 803 for that file (as described in thefollowing section); in this example, servers 201, 202, 203 and 204,collectively identified as the file array 1900. The switch then submitsappropriately modified file read requests 1902, 1903, 1904 and 1905 toservers of the file array 1900, in parallel. The servers 201 through 204receive their respective file read requests 1902 through 1905, executethem in parallel and respond according to protocol back to the switch,each believing that the switch is its client for the individual filethat resides on that server. The file switch 200 collects all responsesfrom the file servers. Next, it updates its state with informationregarding the member files that comprise the aggregated file, eachresiding on one of the servers 201 through 204 of the file array 1900.Then it aggregates the transaction result and submits it back to theoriginal client.

As a result, the client can now initiate various file transactions onthe file (in this example, FILE1), as if it were a single file residingon a single file server. The switch aggregates different transactionsdifferently. Its operation on read and write transactions is describedelsewhere in this document. The operation of the file switch withrespect to concurrency-related requests and issues is described in thefollowing section,

Accessing an Aggregated User File Through the Metafile

FIG. 20 illustrates the preferred method for accessing an aggregateduser file through the metafile. Upon receiving a file operation requestfrom a client, the file switch follows similar patterns without regardto the actual command being processed. The method starts in block 2002and goes through the following steps.

In step 2004, the metafile is accessed to fetch the metadata of the userfile. The location of the metafile is determined by applying a namespacerule to identify a NAS array (i.e., a group of file servers) and byapplying a hash function to the given user file name and the given filepath to identify a particular file server within the identified NASarray.

In step 2006, the file server that stores each individual data file ofthe user file is determined from the metadata of the user file. Treatingthe set of file servers in which the data files are stored as a “filearray,” each file access operation is executed over a specific set ofdata files in the file array.

In step 2008, the file aggregator submits the file access command(s) tothe selected file array (or a subset thereof). The commands arepreferably submitted to the different file array members simultaneously(or in quick succession), so that all members will receive thempractically at the same time.

In step 2010, the file aggregator (i.e., the file switch) waits andreceives response(s) from the selected array of file servers. After alloperations are submitted to their recipients, the file aggregator waitsfor a response from each of the array elements participating in thecommand. The responses may come in any order at any time. It is notnecessary for the file aggregator to wait until the entire and completeresponse is received from a file array member. Once the file aggregatorreceives enough of the response in order to make a decision about thesubmitted command, it may stop waiting for the response from thatmember.

In step 2012, the file aggregator computes the aggregated result. Whenall the file array member responses are received, the file aggregatorcombines them in an aggregate response.

In step 2014, the file aggregator submits a response back to the client.After all responses are received from the file array members and theaggregate result is calculated, the final response is sent back to theclient. Each of the client's operations are preferably executedasynchronously due to the fact that the file aggregator preferablysubmits each command to the file array members across a network.Finally, the method ends in block 2016.

General Algorithm for Handling Client Accesses

This section presents the general aggregation algorithms used toaggregate operations over metafiles in an aggregated file system. Thereare two general algorithms: 1) perform operation over all metafiles forthe user file, and 2) perform operation on a single metafile. Whichalgorithm is used is mostly dependent upon the type of file operationexecuted.

Perform Operation Over All Metafiles

In this algorithm, operations are executed over all metafiles for agiven user file. One case this algorithm is used is for all operationsthat modify the metadata stored in the metafiles. For example, thisalgorithm is used when creating files for access, and when deletingfiles. The operation is repeated over all metafiles in parallel forhighest performance.

Note that the operations are performed only over metafiles that resideon currently available servers. If one of the copies of the metadata isnot available, the modifications are stored in the others; at least onecopy must exist in order for access to be provided.

Perform Operation Over a Single Metafile

This algorithm is preferably used for non-destructive file operationsthat retrieve but not modify data in the metafile, such as getting thelast modified time of the file. In this algorithm, an operation isperformed over the metafile stored in the metaserver with the lowestordinal number. Alternatively, the operation may be performed over themetafile stored in a randomly or pseudo-randomly selected metaserver,from among the metaservers currently believed to be available.

Handling Concurrent Accesses

Since file servers and network file protocols are designed for accessingby multiple clients simultaneously, they typically provide excellentsupport for concurrency handling. For example, the CIFS network fileprotocol provides the ability to request an exclusive file open, meaningthat if two clients request open at the same time, only one of therequests is going to succeed.

In the case of a single file server, this support is often implementedinside the file server by using operating system synchronizationobjects. This works well for a single server in which access frommultiple clients can be serialized within the same computer. However, asthe background discussion explains, extending this approach to multipleservers in a clustered configuration creates a bottleneck. For thisreason, the present invention preferably uses a different mechanism forhandling concurrency.

An Exemplary Concurrency Problem

FIG. 21 illustrates an exemplary concurrency problem when two clientstrying to access the same resources simultaneously. The system 2108consists of two file switches 200 and 2106, file servers 201 through207, and a layer 2 switch 2107, which is used to connect the fileservers and the file switches.

In this example, two clients send requests for a file writesimultaneously. A first client, client A is connected to file switch 200and sends its file write request 2111 to it; a second client, client Bis connected to the file switch 2106 and sends its file write request2101 to it. In this example, the requested file is aggregated from fourdata streams (e.g., four mirrors), each residing on one of the servers201 through 204 (the four servers forming the file array 2100 for thisfile).

Both file switches process the request at the same time and try toprocess it by switching the incoming requests 2111 and 2101 to each ofthe four servers of the file array 2100. File switch 200 sends requests2112 through 2115 to the file servers 201 through 204, respectively.File switch 2106 sends requests 2102 through 2105 to the file servers201 through 204, respectively. While the two switches may have issuedthe requests at the same time, the requests arrive at each of the fileservers in some order. In this example, the file servers 201, 203 and204 receive the requests 2112, 2114 and 2115, respectively, before theyreceive the corresponding requests from the file switch 2106, namely therequests 2102, 2104 and 2105. However, the file server 202 receives therequest 2103 from the file switch 2106 before it receives the request2113 from the file switch 200. One skilled in the art will easilyrecognize that several other orders are possible, as well as similarsituations with more than two clients, more than two switches andanother number of file servers.

Based on the above-described order of arrival of requests, the fileservers 201, 203 and 204 satisfy the write requests 2112, 2114 and 2115coming from file switch 200 (data A) while the file server 202 satisfiesthe request 2103 from the file switch 2106 (data B). The mirrors of thefile contain inconsistent data as a result of the concurrent accesses byboth client A and client B without proper locking mechanism. From thestandpoint of a file switch, both aggregated transactions will fail,since neither of them would succeed in writing all four of the memberfiles. This scenario is clearly in violation of the semantics of thewrite request, which requires that one client should succeed and allothers should fail.

One skilled in the art will recognize that this situation can occur withother operations. For example with a lock request, this situation leadsto the classic deadlock problem. Although the resource that both clientsrequested (i.e., the aggregated file) is available and can be granted toone of the clients easily, none of the clients is able to acquire it(i.e., write to the file). The concurrent access problem describedabove, with respect to write operations, can be solved using implicitlocking, as described next. Concurrency problems associated with theopen-exclusive operation and with lock requests are solved usingmechanisms described below with reference to FIG. 24.

Implicit Locking

Network file protocols typically provide file-level locking andbyte-range locking in order to synchronize multiple clients that try towrite to the same file and the same area within a file. When locking isused consistently by all clients, there is no need for additionalsynchronization in order to avoid inconsistent data being written todifferent mirrors of the same file; however, not all file clientapplications use the locking mechanism consistently.

Implicit locking allows a client to write data into a locked byte rangewhile sharing the same file with other clients. While a client holds alock on a byte range in a file, it is the only client that is allowed towrite data into that portion of the file. Other clients can not read orwrite data in the locked range area. This gives a client an exclusiveaccess to a specific portion of the file but not to the entire file. Ifbyte range locking is used consistently by all clients, there is no needfor additional synchronization in order to avoid inconsistent data beingwritten to different mirrors of the same file. However, not all clientapplications use the locking mechanism consistently, which can result indata corruption in an aggregated file system.

Another application of implicit locking is when the file aggregatorneeds to lock a portion of the file if a client is trying to write datato the file and does not have exclusive access to the target area of thefile. The file aggregator (i.e., the file switch) is configured to lockthe corresponding byte range of a file if the client attempts to writedata into the file without first locking the range itself, theaggregator locks the byte range on behalf of the client. The aggregatorpreferably locks the byte range if the client does not have exclusiveaccess to the whole file or exclusive access to the accessed portion ofthe file in which it intends to write. When the write operation iscomplete, the file aggregator unlocks the previously locked byte regionof the file (if it had locked it implicitly).

FIG. 22 illustrates a method for implementing implicit locking withmetafiles that ensures that a client writing to a file has exclusiveaccess to that portion of the file and keeps all mirrored copies of thefile properly synchronized with the correct data. The method starts inblock 2200 and then moves through the following steps.

In step 2202, the file aggregator receives a file write request from aclient. Typically before issuing a write request, a client preferablyrequests, through the file aggregator, a byte range lock of the sectionof the aggregated file to be modified. Next, the file aggregatorforwards the client's byte range lock request to the appropriate fileservers in the correct NAS array. Then, the file aggregator gathers thebyte range lock results from the file servers, forwards the aggregatedresult back to the client, and saves the state of the specific byterange that has been locked by the client. However, the procedure shownhere does not assume that a byte range lock has already been obtained.

Upon receiving the client's write request, the file aggregator firstdetermines, in step 2204, whether the byte range of the write operationhas been locked by the requesting client. If the byte range is locked,the method moves on to step 2214.

In the alternative, if the byte range is not locked, then the methodmoves to step 2206 where the file aggregator generates byte range lockrequests to each of the file servers that contain a copy of the file onbehalf of the client. In one implementation, the byte range lock requestis forwarded to the appropriate file servers so as to request locks onthe data files containing the data in the specified byte range. To dothis, the primary metafile for the specified user file is first accessedto determine the identities and locations of the data files for thestripes containing the specified byte range. Then the lock requests, forlocks on the required portions of those data files, are forwarded to theappropriate file servers.

In a second preferred implementation, the byte range locks are obtainedon the primary metadata file and its copies; no locks are obtained onthe underlying data files. In particular, a byte range lock may beobtained on a file, such as a metafile, even when the byte rangespecified in the lock request is partially or even completely outsidethe range of data actually stored in the file. Thus, in thisimplementation, the byte range lock requests are directed to all thecopies of the primary metadata file, corresponding to the user file onwhich the lock has been requested (whether explicitly or implicitly). Toprevent deadlocks, the byte range lock request is first directed to theprimary file server for the metafile (as determined, for example, by ahash function or other selection function); and after the lock requestis granted by the primary file server, the same lock request is thendirected to the other file servers on which copies of the metafile arestored.

Both implementations utilize the lock management capabilities of thefile servers, with the primary roles of the file switch being theapplication of the namespace rules to determine the file servers towhich the lock request should be directed, replication of the lockrequest to those file servers, and aggregation of the lock requestresults. In yet another implementation, the aggregation rule applicableto the user file includes a lock redundancy parameter P that specifiesthe number of primary metafile copies on which the lock is obtained. Inthis implementation, the lock request is directed to a primary fileserver for the metafile, and then to P−1 other file servers, selected ina predefined manner (e.g., based on ordinal numbers associated with thefile servers, using a round robin selection function).

In step 2208, the file aggregator gathers the byte range lock resultsfrom the file servers and save the state of the specific byte range thatwas locked. In step 2210, a determination is made as to whether the byterange lock has been acquired by the file aggregator. If the byte rangelock has been acquired, the method continues in step 2214. If the byterange lock has not been acquired, then the file aggregator fails thewrite request and sends a notice to the client in step 2212.

In step 2214, after confirming the client has secured the byte rangelock either in step 2204 or step 2210, the file aggregator performs thewrite operation to all file servers that contain the aggregated file. Instep 2216, the file aggregator receives and aggregates write responsesfrom the file servers. The method then moves to step 2218 where the fileaggregator sends an acknowledgement to the client when the writeoperations have successfully completed.

In step 2220, the file aggregator releases the byte range lock. Thisstep is performed regardless of whether the write operations havecompleted successfully as in step 2218 or the write request has failedas in step 2212. After releasing the byte range lock, the method ends inblock 2222.

When this mechanism is consistently used by the file switch, and in thecase of multiple file switches accessing the same set of file servers byall file switches, it ensures consistency of the data file at a levelcomparable to that maintained by any single file server.

Opportunistic Locks and Caching

Another mechanism frequently deployed with network protocols isOpportunistic Locks (“oplocks”; also known as callbacks). Oplocks allowclients to cache the data file locally to increase performance whilekeeping the files synchronized and consistent. Depending on the networkfile system that is used, oplocks may or may not be supported and thedifferent types of oplocks may vary. Most existing operating systems,including Microsoft Windows and LINUX (e.g., SAMBA), support oplocks.

Oplocks are usually only requested by a client when the client opens afile on a network file server. When requesting an oplock, a clientalways requests an oplock. If the oplock is granted to a client, theclient may then cache data file locally to increase performance. If anoplock is not granted, the client must send all network file requestsover the network and it can not cache any data from the file. A serverdoes not have to grant the oplock specified by the client; it may grantthe client a different level of oplock than the one requested.

FIG. 23 a illustrates a method for handling an oplock request by aclient. The method starts at step 2300 and continues to step 2301 wherethe file aggregator (i.e., a file switch) receives the client's requestof an oplock to a user file. In step 2302, the aggregator sends oplockrequests on the metafiles corresponding to the specified user file to apredetermined array of file servers. Next, the aggregator waits andaggregates the responses from the file servers (step 2303) and grantsthe client the lowest level oplock that was granted by the servers forthe metafiles (step 2304). Note that oplocks are used on metafiles only,not on data files. Then, in step 2305, the aggregator saves the state ofall the granted oplocks from the file servers. In step 2306, the oplocklevel granted to the client is also saved as the current oplock levelfor the file aggregator. The method ends at block 2307.

Oplocks can be “broken” at any time. This means that after a servergrants a specific oplock to a client, the server can send a notificationthat tells the client that it no longer has the right to hold itscurrent oplock. This usually occurs when a second client tries to openthe same file. The server may downgrade the current oplock to adifferent oplock or may remove the oplock completely from the client.Depending on the new oplock granted by the server, the client may haveto flush any cached data file back to the server to keep the filesynchronized with other clients. If the client no longer holds an oplockon the file, all cached data file must be flushed and all subsequentfile operations must be sent over the network to the file server.

FIG. 23 b illustrates a method for handling oplock break notificationsfrom a file server. The method starts at step 2310 and continues at step2311 where an oplock break notification from a sender file server isreceived. Then, in step 2312, the file aggregator (i.e., the fileswitch) compares the level of oplock break notification from the fileserver versus the oplock level granted to the client.

In step 2313, if the level of oplock break notification is lower thanthe oplock level granted to the client, the forwards the oplock breaknotification to the client. Then in step 2314, the aggregator waits forthe client to respond to the oplock break notification, and updates thecurrent oplock level to the new oplock level. In step 2315, theaggregator forwards the client's response to the file server thatoriginated the oplock break notification.

In step 2316, if the oplock break notification specifies an oplock levelthat is equal to or greater than the current oplock level that wasgranted to the client, the aggregator responds to the oplock breaknotification. It then updates its state to reflect the new oplock levelfor this file server in step 2317. Since the client may hold an oplockthat is lower than the oplock specified in the notification, there is noreason to propagate the notification to the client.

In step 2318, if the client never requested an oplock when it opened thefile or does not hold an oplock associated with this file, theaggregator responds to the oplock break notification. It then updatesits state with the new oplock level in step 2319. The method ends instep 2320.

Note that, before responding to any oplock break notification receivedfrom a file server, the aggregator (i.e., file switch) must first updateany oplock state as necessary. As a result, data cached within theaggregator may need to be written back to the file server, if the cacheddata has been modified, and cached data in the aggregator may need to beinvalidated if the oplock is being totally withdrawn by the file server.If multiple oplock break notifications are received from different fileservers around the same time, they are queued and handled one at a time.In addition, it is not necessary to respond to the server's oplock breaknotification if the client chooses to close the aggregated file when itreceives the notification from the aggregator. Some network file systemsaccept a file close operation as a response to an oplock breaknotification.

There are several different types of oplocks that can be granted. Thetypes of oplocks are defined by the network file protocol that is usedwith the file aggregator. The type of oplock defines exactly how theclient can cache data, ordered by the level of caching given to aclient. FIG. 23 c illustrates a method for mapping a level ofexclusivity of caching to the oplock exclusivity level granted. Forexample, when using the CIFS file protocol, an “exclusive” oplock allowsthe client 2330 to cache a data file “myFile.doc” 2331 locally. Under anexclusive oplock, all read and write operations can be executed locallyand therefore the file access time is reduced. A “level 2” oplock allowsthe data file “myFile.doc” 2333 to be cached in the file switch 2332 orin the client. A level 2 oplock allows all clients given this level ofoplock to cache read data locally. (The oplock is revoked the first timesomeone writes to the file). Note that the file switch can also use theoplock level in order to determine whether it can cache read data, inaddition to or instead of the clients. This file is shared among clientssupported by the file switch 2332. “No Oplock” is the lowest level,where the client is not allowed to cache the file “myFile.doc”. Under“no oplock”, mirrors of this file 2335 and 2337 are stored in the fileservers 2334 and 2336 respectively.

In an alternate embodiment, oplocks requests are directed to and handledby the file servers that store data files for a specified user file,instead of being handled by the file servers that store the metafile forthe specified user file. The file switch distributes the oplock requeststo the file servers accordingly, and also aggregates the oplockresponses, break messages, and so on from the same file servers. Thenumber of file servers to which each oplock request is directed isdetermined by the number of stripes that are included in the subset ofthe file for which an oplock is being requested, and the level of lockredundancy to be used. This method allows the file switch to cachefragments of the file differently on different file servers.

In one embodiment, implicit locking is used in combination withopportunistic locking. In particular, when a client does not request anoplock in conjunction with an operation on a user file, the file switchmay nevertheless request an oplock from the file servers when predefinedimplicit locking criteria are met (e.g., when the nature of the clientrequest, or a usage pattern by the client, indicates continued access tothe file is likely). When the implicit oplock is granted, the fileswitch preferably caches data from the file specified by the client,without the client having any knowledge that such caching is occurring.By opportunistically caching data in the file switch, the file switchprovides faster access to data in the specified file. This can beespecially helpful when the file switch is much closer to the clientcomputer than the file servers on which the requested file resides. Inaddition, while the file switch caches data from a file, it can respondto requests from more than one client requesting data from that file,using the same cached data to provide fast responses to each of theclients, so long as none of the clients requests exclusive access to thefile.

In some embodiments, the file switch can cache data and use the cacheddata to provide fast response to two or more clients or clientcomputers, even when one or more of the clients have requested an oplockon the same file. In other words, when a second client attempts toaccess the same file for which an oplock has been granted, the oplock isnot necessarily broken. Rather, if the accesses by all the clients arecompatible, then the file switch caches the oplock state (if any)associated with each client requesting access to the same file, andsends responses to the clients using the cached data from the file. Thecaching of the data in the file switch ends when caching terminationcondition arises, such as a client requesting exclusive access to thefile, or all clients closing the file.

Semaphores

A semaphore is a mechanism that allows only a certain number of entitiesto access a particular resource. In the context of an aggregated filesystem, a semaphore is used to allow only one file switch to access aspecific aggregated file at a time. This includes all occurrences of thefile on all file servers in the NAS array (i.e., if the file is stripedor mirrored among multiple file servers). In an aggregated file system,the semaphore is achieved using the primary metadata file stored on theNAS arrays as the semaphore object. The process that obtains access tothe primary metadata file also obtains access to the aggregated userfile as a whole (the file may still be shared among multiple clients).

The semaphore synchronization mechanism is used mainly with destructivefile operations. Destructive file operations include creating a newfile, truncating an existing file, deleting an existing file andrenaming or moving an existing file. The semaphore synchronizationmechanism is also used with non-destructive operations, such asexclusive open.

Synchronization is needed for destructive operations since executing theoperations over a specific file changes some aspect of the file; if theaggregator needs to back out and let another entity have access to thesame file, it would have to restore the state of all files that itaccessed. This would require keeping the states of the transactions onthe file switch, which is very costly and can degrade performance. Byusing the semaphore synchronization mechanism, an aggregator does notexecute destructive file operations over any files unless it is grantedaccess to the files by way of a semaphore.

FIG. 24 illustrates a method for handling concurrent accesses using asemaphore. The method starts in step 2400 and moves to step 2401 wherethe file aggregator receives a request for opening the file forexclusive access (not a destructive operation). Also in step 2401, thefile aggregator determines the location of the primary metafile of therequested user files by applying a hash function on the user file name.

Next, in step 2402, the file aggregator tries to open the primarymetafile with exclusive file access and no file sharing allowed. In step2403, a first determination is made as to whether the primary metafilehas been successfully opened. If the answer is positive, the methodcontinues in step 2405. If the answer is negative, the file aggregatorfails the client's file access request and moves to step 2409; or waitsa random amount of time and retries to open the primary metafile again.There should be a limit on the number of retries. If opening themetafile has succeeded, the aggregator is granted access to theaggregated file. If there is more than one copy of the primary metafile,then the open is considered successful if all opens completedsuccessfully; if at least one open failed indicating that the file isalready open, the client's request for exclusive open will be denied.

In step 2405, the file aggregator opens all the data streams on all ofthe file servers of this user file's file array, or alternately opensall the data streams that will be needed for the destructive fileoperation. Step 2405 ensures that all the data streams required for thedestructive file operation are available.

In step 2406, a second determination is made as to whether all openrequests have been granted by the file servers. If any of the openrequests fail, the file aggregator fails the client's file accessrequest in step 2407 and moves to step 2409. In the alternative, if allopen requests have been granted successfully, the method moves to step2408 and the file aggregator performs file access on all data streamfiles. In step 2409, after all the file accesses have been completed,the file aggregator closes all the data files and then closes theprimary metafile(s). The method ends in step 2410.

With each aggregator accessing the files using this methodology, it canbe guaranteed that the access to the file will be properly synchronized.

Summary of Aggregation of Concurrent Accesses

One skilled in the art will recognize that other algorithms may beemployed to achieve the same results and ensure consistent and atomicbehavior for aggregated transactions. Similarly, one skilled in the artwill recognize that the same approaches may be applied to other filetransaction types, such as locking, creation, etc.

In effect, the present invention aggregates the existing synchronizationmechanisms provided by network file protocols (and thus by the fileservers in the system) to implement synchronization between the clientsof multiple independent file switches without requiring directinteraction and communication, and therefore, coupling, between the fileswitches. In addition, each individual file switch can further use thesemechanisms in order to synchronize transactions requested by multipleclients that are connected to that switch.

Directory Enumeration

When a file switch receives a directory enumeration request from aclient, the request may specify to enumerate an entire directory (notincluding sub-directories) or it may enumerate a single file. Singlefile enumeration is typically used to determine whether or not aspecific file exists in the file system. This section covers how toenumerate a single directory or a single file.

When a directory enumeration request is received, the aggregated filesystem uses the namespace aggregation rules to determine which NASarrays need to be enumerated in order to satisfy the request. Anyparticular directory (i.e., an aggregated directory in the usernamespace) may be distributed over multiple different NAS arrays becausemultiple namespace rules may apply to the files in that one directory.The file aggregator enumerates the corresponding directories on all theNAS arrays that are the target of the applicable namespace rules,combines the results, and propagates the combined result back to theclient.

When enumerating the directories in an aggregated file system, all ofthe file servers of a specific NAS array are preferably enumerated fortheir directory contents. This is due to the fact that a hash functiondistribution function is used to distribute the metadata files amongdifferent file servers of the NAS array. Only the metafiles areenumerated; data files are ignored. The main goal of the aggregateddirectory enumeration mechanism is to efficiently eliminate duplicatefiles in the enumeration so that aggregated directory enumeration isfast and efficient.

The basic aggregated directory enumeration method is as follows. When afile switch needs to enumerate a directory on a NAS array, the client'senumeration request is replicated in parallel to all of the file serversin the NAS array. The file switch receives all of the responses from theservers and builds the enumerated directory structure entirely inmemory. The file switch does not wait for the entire directory structureto be built in memory before sending enumeration results back to theclient. Rather, the enumeration results are sent back to the client assoon as they are available.

The directory enumeration strategy is defined in the following twosections:

-   -   Enumeration State: Describes the internal state that the file        switch needs to maintain during a directory enumeration        operation.    -   Enumeration Algorithm: Defines the algorithm of how to enumerate        a directory over a set of NAS arrays.        State Information Related to the Directory Entries

In order to enumerate the directories on a NAS array, the enumerationrequest is sent to all file servers of the array and the responses arecollected. Since the enumerated directory structure is built entirely inmemory from these responses, the file switch needs to maintain thefollowing internal state (i.e., the enumeration state):

-   -   a list of directory entries;    -   additional state related to the directory entries; and    -   a list of pointers to the directory entries.        A List of Directory Entries

After the enumeration request is replicated to all file servers of a NASarray, the file switch collects all of the responses. These responsescontain a list of files that are contained in the enumerated directory.The responses should contain only listings of primary and secondarymetafiles, because data files are stored in a different sub-tree on thefile servers. For each listed file, the response contains the directoryinformation requested in the enumeration request such as file name, filesize, and other file attributes. Each file listing returned in theenumeration set is known as a directory entry.

Each file found in the enumeration response is added to a list/array ofdirectory entries maintained in memory in the file switch. In apreferred embodiment, each directory entry is added to the list in theorder in which it is received and processed. The list or array ispreferably implemented as either a queue or a linked list.

Each distinct user file must appear in the final enumerated list onlyonce. Duplicate file names refer to files with the same name that arelocated in the same user namespace directory. Duplicate files may appearbecause the file switch replicates the metadata files for redundancy.

Additional State Relate to the Directory Entries

For each directory entry, there is additional state that is tracked bythe file switch during enumeration. This state includes the following:

-   -   The number of times the file was found in the enumeration        (duplicate files). This occurs since metadata files are        replicated for redundancy. Separate counters are maintained for        the primary and secondary metafiles.    -   Whether or not the file has been submitted back to the client as        part of the directory enumeration response.

The additional state can be kept as part of the directory entry array orcan be stored in a separate array.

A List of Pointers to the Directory Entries

For each directory entry that is processed by the file switch, the fileswitch must search the directory entry list to see if the file isalready included in the list. This can be a very time consuming process,especially if the directory entry list contains thousands of unsortedentries.

In order to speed up the enumeration process, the file switch mustmaintain a list or array of memory pointers that point to specificentries in the directory entry array. The pointer list contains pointersto the directory entries ordered alphabetically. Using the pointer list,the file switch can quickly search through the directory entries using abinary search to find out whether or not a file exists in the directoryentry list. If a new file needs to be added to the list, the file switchonly needs to update the pointer list and no entry data needs to becopied in memory.

Directory Enumeration Algorithm

FIG. 25 illustrates directory enumeration for the aggregated filesystem. During directory enumeration, directory requests are sent toredundant directories of metafiles and duplicate responses are filteredout. This is done to ensure that if a file server fails while processinga directory enumeration request, the directory enumeration request isprocessed to completion using data obtained from the other file servers.The directory enumeration request is processed just as quickly as if thefile server had not failed. Thus, the directory enumeration method makesindividual file server failures invisible to the client. Only if thereis a failure of all the file servers on which redundant metafiles arestored will directory enumeration service to the client computers beimpacted.

The method starts in step 2500 and then moves to step 2501 where thefile switch receives a directory enumeration request (e.g., a commandasking for a listing of all files in a particular directory) from aclient.

In step 2502, given the directory to be enumerated, the file switchdetermines the set of NAS arrays that need to be enumerated based on thenamespace aggregation rules and the directory path being enumerated.More particularly, the file switch determines, from the directory pathspecified in the request, all namespace rules that are applicable to therequest. Those rules specify the NAS arrays that store the files in thespecified directory path. Each NAS array is enumerated in exactly thesame way. The file switch may enumerate the NAS arrays one at a time.When the enumeration is completed on one NAS array, the file switchmoves to the next NAS array (if any) using the same internal stateinformation.

Once the set of NAS arrays is determined, each NAS array is enumeratedone at a time. Step 2503 marks the beginning of the control loop forprocessing directory information for each NAS array identified in step2502. In step 2503, the file switch extracts the match path portionafter the last backslash ‘\’ of the enumeration path (e.g. “*.*”,“.doc”, or “a*.doc”). If the first character of the match path is notthe wildcard character “*”, the single character wildcard “?” is addedas a prefix to the match path. If more than one NAS array is identifiedin step 2502, the match path portion of the enumeration path (extractedin step 2503) is different for each identified NAS array because eachstores only a portion of the files in the directory to be enumerated.For example, a first particular NAS array identified in step 2502 mayonly store files (in the specified directory) having a file extension of“doc”. If the directory enumeration request is for files starting withthe letter “a” (e.g., dir a*.*), the extracted match path portion forthis first NAS array would be “?a*.doc”. In other embodiments, wherethere is no secondary metafile, the metafile has the same name as theuser file, so the extracted match path will not need the “?” prefix.

The extracted match path portion is used by the file switch in step 2504to retrieve all of the metafiles that match the match path portion. Inthe simplest case, if the enumeration path specifies only a single filewith no wildcards (e.g., “dir file1.doc”), the file switch simplyreplicates the request to the appropriate set of file servers of asingle NAS array, with a “?” wildcard prefixed to the filename. Theresponses are collected and a consolidated response is sent back to theclient. No other steps are executed. The directory entry list, pointerlist and additional state information are emptied or reset to contain noentries.

More generally, in step 2504, the file switch replaces the enumerationpath according to the namespace aggregation rules (i.e., as determinedin step 2503) applicable to the NAS array currently being processed, andreplicates the enumeration request in parallel to all of the fileservers in the NAS array that are configured to store metadata files. Insome embodiments, the NAS array is configured so that some of the fileservers in the NAS array store metadata files, while other file serversare configured to store data files (i.e., files other than metadatafiles); in other embodiments, some file servers may be configured tostore both metadata files and data files, while other file servers areconfigured to store only data files. In step 2505, the file switch waitsand receives the responses to the enumeration requests from the fileservers.

Step 2506 marks the beginning of the control loop for processing theresponse received from each file server. In step 2506 a first or nextfile name in the response received from a file server is processed. Thefile switch searches the pointer list by file name to see if the filename is already included in the directory entry list. During this step,the ‘P’ or ‘S’ prefix of the file name, which indicates whether thelisted file is a primary or secondary metafile, is stripped from thefile name for purposes of searching the pointer list.

In step 2507, a determination is made as to whether a new entry has beenreceived. If the entry is not new, i.e., the file exists in thedirectory entry list built in memory, then the method takes the NObranch and moves to step 2509 where the file switch updates the stateand pointer related to the existing directory entry. The state of thedirectory entry includes the directory information returned by the fileserver with the directory entry. In step 2509, the file switch alsoupdates the additional state of the directory entry with the number oftimes the primary and secondary metafiles have been found.

In the alternative, if the entry is new, then the method takes the YESbranch and moves to step 2508 where the file switch adds the directoryentry to the directory entry list and initializes the state of the newdirectory entry. The filename used in the directory entry does notinclude the ‘P’ or ‘S’ prefix of the primary or secondary metafilerepresented by the received filename. The file switch also updates thepointer list with a pointer to the new directory entry in the properalphabetical order and initializes any other additional state needed forthe new entry.

In step 2510, a determination is made as to whether both the primary andsecondary metafiles for a user file have been found. If the primary andsecondary metafiles have not been found according to the fileaggregation rules, the file switch does not send the directory entryback to the client that requested the directory enumeration, because itdoes not yet have sufficient information to send back to the client.Instead, the method moves to step 2512 and continues with the next entryreturned by the file servers (at step 2506). In the alternative, if boththe primary and secondary metafiles have been found, the directory entrycontains all the requested directory information for the correspondinguser file, and this directory entry is sent back to the client. Thedirectory information for the secondary metafile contains the aggregatedfile size and allocation size of the user file. The directoryinformation for the primary metafile contains all other fileinformation, including access/creation dates and times, file attributesand so on. (An alternate embodiment that changes the operation of step2510 is discussed below.)

In step 2511, the file switch submits the entry back to the client aspart of the enumeration response. The file switch preferably uses adifferent thread to submit an entry back to the client. This thread runsin parallel with the threads that are enumerating the directories on thefile servers. If the entry has already been submitted back to theclient, the file switch does not return the entry to the client in step2511, and instead skips over to step 2512.

In step 2512, a determination is made as to whether all files in thedirectory has been enumerated. If the answer is negative, the NO path istaken and the method moves to step 2515 before it continues with thenext entry returned by the file server (step 2506). The directoryenumeration continues until all of the files are enumerated and storedin memory. In the alternative, the YES path is taken and the methodmoves to step 2513. Note that if there are any directory enumerationerrors, but at least one of the enumeration requests to the file serversis successful, a positive enumeration response is sent back to theclient with the collected enumeration results. If all of the enumerationrequests fail, the client's enumeration request fails and a failureresponse is returned to the client.

In step 2513, a determination is made as to whether all file servershave been enumerated. If the answer is negative, the NO path is takenand the method moves to step 2515 before it continues with the next fileserver in the file array (at step 2504). In the alternative, the YESpath is taken and the method moves to step 2514 where anotherdetermination is made as to whether all NAS arrays have been enumerated.If the answer is negative, the NO path is taken and the method moves tostep 2515 before it continues with the next NAS array in the switchedfile system (at step 2503). In the alternative, the YES path is takenand the method ends in step 2516.

In step 2515, a termination condition is checked as to whether theclient has closed the enumeration. If the termination condition has notoccurred, the method continues at step 2503, 2504 or 2506, depending onthe iteration loop the method is in, as indicated by which step wasperformed (namely 2512, 2513 or 2514) prior to step 2515. In thealternative, if the termination condition has occurred, the YES path istaken and the method ends in step 2516.

Note that when enumerating directories, the total number of entries thatare in the enumeration set may exceed the number of entries that can bereturned back to the client due to limitations of the client's responsereceive buffer. If this situation occurs, the file switch sends anenumeration response containing a subset of the entries with anindicator that indicates there are more entries in the enumeration. Thisenables the client to send another enumeration request to retrieve theremaining entries.

When updating the directory entry list of an existing entry, severalentry attributes need to be updated (see step 2509 above). The mostimportant attribute is the size or allocation size of the file. For eachaggregated file, the size of the file is stored in the secondarymetafile encoded in one of the time/date fields associated with thefile. The allocation size is determined by taking the aggregated filesize and multiplying it by the number of mirrors. All other fileattributes are retrieved from the primary metafile. These attributesinclude last accessed date and time, creation date and time, lastwritten date and time, and so on.

If after a directory entry is submitted back to the client, the fileswitch receives another occurrence of the same file listing on one ofthe other file servers, this is not considered an error—becausemetafiles are purposely replicated. In this case, the file listingreceived from the file server is ignored.

In an alternate embodiment, directory entries are not submitted back tothe client at step 2511, but instead a sorted list of directory entriesis built at step 2511. The resulting sorted list is returned to theclient when the building of the list is complete, just before step 2516.

In another alternate embodiment, only a primary metafile is provided foreach user file, and no secondary metafile is used. As explained above,one of the directory fields of the primary metafile is used to store theaggregated file size for the corresponding user file. In thisembodiment, step 2510 can be eliminated. Instead, step 2508 is followedby step 2511, but step 2509 is followed by step 2512. In other words,whenever a new metafile is found, its entry is submitted to the client,but when a redundant metafile is found the directory enumerationprocedure skips over it, except for bookkeeping (step 2509).

The directory enumeration method shown in FIG. 25 can also be used, withminor modifications, to perform other directory operations (sometimescalled file commands), such as changing a specified file attribute for aspecified set of files (e.g., “attrib +r c:\x\y\ab*.doc”) or deleting aspecified set of files (e.g., “del c:\x\y\abcd*.doc”). In step 2504, thefile command is sent to the applicable file servers of NAS serveridentified in step 2502. Steps 2506 to 2510 are replaced by similarsteps for aggregating the responses obtained from the file servers, andin step 2511 or 2516 the aggregated responses are returned to theclient.

Redundant Metavolume Controller

A collection of user files is referred to as a “volume” of data files. Avolume of data files may be stored on one or more file servers, and afile server may host one or more logical volumes. In the context of themetadata based file switch and switched file system, a collection ofmetafiles corresponding to the collection of user files is called a“metavolume”. It is desirable to replicate metavolumes over multiplefile servers to provide backup of the metafiles and to provide continueoperation of the switched file system in event of a failure of one ofthe file servers used to store the metafiles.

A group of file servers in a NAS array can be designated to storemetafiles. Each such file server is called a metaserver. In someimplementations, all metaservers in a NAS array have identical metafilecontent (i.e., they all store copies of the same metafiles). In otherimplementations, while each metafile is replicated N times on a set ofmetaservers selected using a distribution function, the number ofmetaservers is greater than N, and therefore the metaservers do not haveidentical content. Once a metavolume is created, its configuration (withrespect to the metaserver and directories in which the metafiles arestored) does not change. Each metaserver within the redundant metavolumeis assigned an ordinal number. This ordinal number also does not changeonce a metavolume assigned to the metaserver is created.

Accessing Redundant Metavolumes

In general, there are three types of redundant metavolume operations:destructive operations, non-destructive operations and creating new fileor lock acquisition. A non-destructive operation, such as a readoperation, does not change the content or attributes of the metavolume,so this operation is performed on any one of the metaservers. On theother hand, a destructive operation, such as a delete operation, doeschange the content or attributes of the metavolume, and this operationis performed on all the metaservers of the NAS array to which themetavolume has been mapped. For creating new file or lock acquisition,the operation is performed first on the primary metaserver to obtain theexclusive access to the metavolume, and then the operation is performedon all other metaservers of the metavolume.

FIG. 26 illustrates a method for accessing redundant metavolumes. Themethod starts in block 2600 and thereafter moves to block 2602. At block2602, the redundant metavolume controller (RMC) receives a request froma file aggregator to access the redundant metavolumes stored in a groupof metaservers. In a preferred embodiment, the RMC is implemented as asoftware module within the aggregated file system 616 (FIG. 6). Inanother embodiment, the RMC may be implemented using one or moreapplication specific integrated circuits (ASIC's), or a combination ofASIC's and software.

At block 2604, the RMC selects a primary metaserver. The primarymetaserver is selected based on the name of the metafile. In oneembodiment, the RMC selects the primary metaserver by computing a sum Sof all character values of the metafile name and then computer S moduloM, where M is the number of metaservers. The resultant number is used bythe file switch as the ordinal number of the primary metaserver. Inanother embodiment of the present invention, the primary metaserver isselected by computing a hash function of the name of the metafile. Theresultant number of the hash function is the ordinal number of theselected primary metaserver. Both of these methods distribute theprimary metafiles evenly across the available metaservers, and henceimprove the performance of the overall system. In yet anotherimplementation, the primary metaserver is a predefined one of themetaservers, such as the metaserver having the lowest ordinal number.

At block 2606, a determination is made as to the type of the requestedoperation. If a destructive operation is requested, the path to 2612 istaken; if a non-destructive operation is requested, the path to block2608 is taken; and otherwise the path to block 2616 is taken forhandling operations such as creating a new file, lock acquisition,rename, and the like.

At block 2608, the RMC sends the non-destructive operation request tothe available metaserver with the lowest ordinal number. Alternately,the RMC sends the operation to a randomly or psuedo-randomly selectedmetaserver, from among the metaservers currently believed to beavailable. Next, the method moves to block 2610 where a determination ismade as to whether the metaserver to which the request is sent isavailable. If the metaserver is unavailable, the NO path is taken andthe RMC retries the operation to the next available metaserver (by thenext lowest ordinal number) by repeating the steps in blocks 2608 and2610. In the alternative, if the metaserver is available, the methodmoves to block 2620.

At block 2612, the RMC sends the destructive operation request to allmetaservers and aggregates the responses from all the metaservers. Next,the method moves to block 2614 where a determination is made as towhether at least one of the accesses to the metaservers is successful.If none of the accesses to the metaservers is successful, the NO path istaken and the RMC fails the destructive operation request. If the accessto at least one, but not all of the metaservers is available and returnssuccess, the operation is considered to have been successfully complete,and the YES path is taken to block 2620. If the destructive operationfails on a particular metaserver, the operation may be retried one ormore times, and if the operation continues to fail, the metaserver maybe denoted as being inoperative and in need of repair.

At block 2616, the RMC sends either the creating new file request or therange lock acquisition request to the primary metaserver. If therequested operation on the primary metaserver fails (but the primarymetaserver is available), the FAIL path is taken and the RMC fails theoperation request; if the primary metaserver is unavailable, anothermetaserver is chosen as a primary and the operation is retried. In thealternative, if the access to the primary metaserver is successful, theSUCCESS path is taken and the method moves to block 2618.

At block 2618, the RMC sends either the creating new file requests orthe lock acquisition requests to all other metaservers. It is expectedthat the operation will succeed on those other metaservers; anunexpected failure (other than the metadata server just beingunavailable) is usually an indication of inconsistency among themetadata servers.

At block 2620, based on the successful accesses to a metaserver ineither block 2610, 2614 or 2618, the RMC saves a primary metaserverstatus in accordance with the metaserver or metaservers thatsuccessfully handled the access operation.

At block 2622, the RMC saves the states of the available metaservers andresponds to the requested operation.

At block 2624, the RMC saves states information indicating whichmetaservers successfully handled the access operation. Preferably, theseare the only metaservers to which subsequent operations for thismetafile will be sent. For some operations, this step 2624 may beskipped. The method then ends in block 2626.

The foregoing description, for purposes of explanation, has beendescribed with reference to specific embodiments. However, theillustrative discussions above are not intended to be exhaustive or tolimit the invention to the precise forms disclosed. Many modificationsand variations are possible in view of the above teachings. Theembodiments were chosen and described in order to best explain theprinciples of the invention and its practical applications, to therebyenable others skilled in the art to best utilize the invention andvarious embodiments with various modifications as are suited to theparticular use contemplated.

1. A method of processing a user request to perform an operation on auser file, comprising: receiving one or more user requests to perform aspecified operation on a specified user file; selecting, from among agroup of rules, a rule applicable to the specified user file, each rulein the group of rules including at least one parameter specifying, forfiles to which the rule is applicable, how to distribute storage of eachsuch file over the file servers in a group of file servers; performingthe specified operation in accordance with the selected rule, including,when the specified operation changes the size of the specified userfile, sending commands to a plurality of the file servers so as tocontinue to distribute storage of the specified user file in accordancewith the selected rule; wherein the rules in the group of rules areordered and wherein each rule in the group of rules has an associatedrange of files to which the rule is applicable; and wherein the range offiles for a particular rule in the group of rules is specified by filesnot falling within the range of any higher order rule and having one ormore characteristics.
 2. The method of claim 1 wherein each rule in thegroup of rules includes a striping parameter specifying a maximum sizeof file portions into which the user file is divided and wherein eachrule in the group of rules includes a mirroring parameter specifying anumber of instances of the user file to be stored on the file servers.3. The method of claim 1 wherein each rule in the group of rulesincludes a caching parameter selected from at least one of a read aheadcaching parameter specifying whether read ahead caching is enabled forfiles to which the rule is applicable and a maximum cache size forcaching any particular file to which the rule is applicable.
 4. Anapparatus for use in a computer network having a plurality of fileservers and a plurality of client computers, the apparatus comprising:at least one processor; a memory coupled to the at least one processorwherein the at least one processor is configured to execute programmedinstructions stored in the memory comprising: receiving one or more userrequests to perform a specified operation on a specified user file;selecting, from among a group of rules, a rule applicable to thespecified user file, each rule in the group of rules including at leastone parameter specifying, for files to which the rule is applicable, howto distribute storage of each such file over the file servers in a groupof file servers; and performing the specified operation in accordancewith the selected rule, including, when the specified operation changesthe size of the specified user file, sending commands to a plurality ofthe file servers so as to continue to distribute storage of thespecified user file in accordance with the selected rule; wherein therules in the group of rules are ordered and wherein each rule in thegroup of rules has an associated range of files to which the rule isapplicable; and wherein the range of files for a particular rule in thegroup of rules is specified by files not falling within the range of anyhigher order rule and having one or more characteristics.
 5. Theapparatus of claim 4 wherein each rule in the group of rules includes astriping parameter specifying a maximum size of file portions into whichthe user file is divided and wherein each rule in the group of rulesincludes a mirroring parameter specifying a number of instances of theuser file to be stored on the file servers.
 6. The apparatus of claim 4wherein each rule in the group of rules includes a caching parameterselected from at least one of a read ahead caching parameter specifyingwhether read ahead caching is enabled for files to which the rule isapplicable and a maximum cache size for caching any particular file towhich the rule is applicable.
 7. A non-transitory computer readablemedium having stored thereon instructions for processing a user requestto perform an operation on a user file comprising machine executablecode which when executed by at least one processor, causes the processorto perform steps comprising: receiving one or more user requests toperform a specified operation on a specified user file; selecting, fromamong a group of rules, a rule applicable to the specified user file,each rule in the group of rules including at least one parameterspecifying, for files to which the rule is applicable, how to distributestorage of each such file over the file servers in a group of fileservers; performing the specified operation in accordance with theselected rule, including, when the specified operation changes the sizeof the specified user file, sending commands to a plurality of the fileservers so as to continue to distribute storage of the specified userfile in accordance with the selected rule; wherein the rules in thegroup of rules are ordered and wherein each rule in the group of ruleshas an associated range of files to which the rule is applicable; andwherein the range of files for a particular rule in the group of rulesis specified by files not falling within the range of any higher orderrule and having one or more characteristics.
 8. The medium of claim 7wherein each rule in the group of rules includes a striping parameterspecifying a maximum size of file portions into which the user file isdivided and wherein each rule in the group of rules includes a mirroringparameter specifying a number of instances of the user file to be storedon the file servers.
 9. The medium of claim 7 wherein each rule in thegroup of rules includes a caching parameter selected from at least oneof a read ahead caching parameter specifying whether read ahead cachingis enabled for files to which the rule is applicable and a maximum cachesize for caching any particular file to which the rule is applicable.